Low level ODM library
$ npm install --save nosqwal-memory
const nosqwal = require('nosqwal-memory');
const db = nosqwal();
const userCollection = db.defineCollection('user');
userCollection.create({
username: 'Alice',
password: '*****'
})
.then(alice => {
return userCollection.query(
where: {
username: {
$eq: 'Alice'
}
},
limit: 1
});
})
.then(users => {
console.log(users[0].username);
//=> 'Alice'
});
Type: Object
Default: {}
Options needed to customize your nosqwal instance, they are different for each nosqwal adapters
Type: string
Name of the collection
Retuns a Promise that resolve to the newly created document
The property id
is added to that document
Type: Object
The document that will be created
Returns a Promise that resolve to the requested document
The unique identifier of the document to retrieve
Returns a Promise that resolve to the updated document
Type: string
The object that will replace the current document stored in the database
The unique identifier of the document to update
Returns a Promise that resolve in an array of the requested document
Type: Object
Type: string
Key or path of field to match
Key could also be one of the following for more complex query:
$not
$and
$or
Type: object
WhereClause define the where clause for a field. WhereClause can also be the same as where
for more complex query.
Operator can be:
operator | description | value type |
data type |
---|---|---|---|
$eq |
equal to | any |
any |
$ne |
not equal to | any |
any |
$gt |
gretter than | string ,number ,Date |
string ,number ,Date |
$gte |
gretter or equal to | string ,number ,Date |
string ,number ,Date |
$lt |
lower than | string ,number ,Date |
string ,number ,Date |
$lte |
lower or equal to | string ,number ,Date |
string ,number ,Date |
$contains |
string/array contains | any |
string , Array |
$in |
is in array | Array |
any |
Type: array
Default: []
Type: string
Path / key to order
Is ascending
Type: bool
Default: true
Type: number
Default: undefined
How many documents will be returned
Type: number
Default: 0
MIT © Thomas Sileghem