just-json
Root object props & methods
DB = schemas: // ...listing of schemas { // GET or SET database configs let opts = path: 'stores/db' schema: './_schemas.json' }
Collection methods
add(item)
— add record to collectionsave(item)
— alias for add methodget(id, fields)
— retrieve record from collectionupdate(id, data)
— update record with [id]remove(id)
— remove record with [id]sync(data)
— synchronize/replace data in current collectioncount()
— get count of records in current collectionfind()
— Promise-based method.find().run().then()
with finder model. Search methods see bellow.
Finder methods
equals(key, val)
notEqual(key, val)
gt(key, val)
gte(key, val)
lt(key, val)
lte(key, val)
matches(key, reg)
paginate(count, sort)
one()
run()
Usage example
_schemas.json
app.js
const DB = DB; // add collectionvar Movie = DB; // add item into "Movie" collectionlet key = Movie; let mov = Movie; // return value of [_id] fieldconsole;Movie; // remove item mov = Movie; // try to get againconsole; // return -> null // add a record againlet key = Movie; console; // -> 1 // test find methodMovie ;