myjson-box
v0.0.9
Published
Persistence for JSON data, as a database NO SQL
Downloads
4
Readme
MyJSON
Standalone and simple persistence for JSON data, as a database NO SQL
How It Works
- Build a tree directory structure as user definition.
- Load / store data according previous structure.
Usage
JS Applications
Suitable for applications that have their own database control.
Install by npm:
$ npm install myjson-box
Config
MyJson auto read ./dbs/ directory to load/store databases
myjson.create():
const myjson = require("myjson-box") myjson.open().then(dbs => { console.log("-------", "DataBases", "-------"); console.log(dbs); return dbs.company.create("menus"); }).then(menus => { console.log("-------", "MENUS", "-------"); console.log(menus); menus.save({_id:2, href: "#top", text: "anchor"}); return menus.get("users"); }).then(users => { console.log("-------", "USERS", "-------"); console.log(users); console.log("-------", "USER (5)", "-------"); return users.deleteById(5); }).then(users => { console.log(users.findById(2)); }); myjson.create("test").then(test => { return test.create("products"); }).then(products => { products.save({_id:1,name:"laptop", price:99.32}); });
test
npm test