Waterview

Waterview : NoSQL Database

Lightweight NoSQL Database for quick prototypes. Requires zero setup.

Contribute Creators NPM

:octocat: UPDATE: getWhere now accepts multiple parameters, allowing accurate and more practical look-up.

Installation : npm install waterview

Quick example:

/db_config.js
const waterview = require('waterview')

waterview.createDatabase('facebook', function(){
  waterview.createCollection('users')
})
/server.js
waterview.insert('users', {
  "name" : "Rahul Sonwalkar",
  "email" : "rahul@example.com",
  "age" : 20,
  "drivers_license" : true
})

More Examples:

Documentation:

Installation

npm install waterview --save

Import

const waterview = require('waterview')

Create a new Database

waterview.createDatabase('myDB')

Creates a new database called myDB and establishes a connection.

Connect to a Database

waterview.connect('myDifferentDB')

Establishes a connection with an existing database. Throws an error if the database doesn’t exist.

Create a new Collection

waterview.createCollection('users')

Creates a collection called users under the connected database

Insert an entity

waterview.insert('users', {
  "name" : "Rahul Sonwalkar",
  "email" : "rahul@example.com",
  "age" : 20,
  "drivers_license" : true
})

Insert multiple entities

waterview.insertAll('users', [
  {
    "name" : "Rahul Sonwalkar",
    "email" : "rahul@example.com",
    "age" : 20,
    "drivers_license" : true
  },
  {
    "name" : "John Doe",
    "email" : "johndoe@mail.com",
    "age" : 41,
    "drivers_license" : false
  },
  {
    "name" : "Gordon Ramsay",
    "email" : "ramsay@mail.com",
    "age" : 55,
    "drivers_license" : true
  }
])    

Inserts all multiple entities into users collection

Get an entity

:octocat: Update: version 0.0.13 onwards getWhere accepts multiple parameters for accurate and more practical lookup.

waterview.getWhere('users', {name : "Rahul Sonwalkar", age : 20}, 'rahul@example.com')

>> [{
    "name" : "Rahul Sonwalkar",
    "email" : "rahul@example.com",
    "age" : 20,
    "drivers_license" : true
   }]

Returns the first entity where email is rahul@example.com

Get all entities

waterview.getAll('users')

Returns an array containing all entities in users collection