TrivialDB是一款轻量级的专门用于存放Key-Value形式的Json数据的持久化数据库,概念上它是lodash封装了纯JS对象,便于版本同步。
创建命名空间:
var trivialdb = require('trivialdb');// Create a namespacevar ns = triviadb.ns('test-ns');// Create a namespace with some optionsvar ns = triviadb.ns('test-ns', { dbPath: 'server/db' });// Create a database inside that namespacevar db = ns.db('test', { writeToDisk: false });创建数据库:
var trivialdb = require('trivialdb');// Open or create a databasevar db = trivialdb.db('some_db');// Open or create a database, with optionsvar db = trivialdb.db('some_db', { writeToDisk: false });
评论