This module is a local storage database adapter for mesh - a library that makes it easy to persist data through multiple transports.
Features
- offline-mode - enable users to browse your application without an API (assuming there's local data)
- faster initial load times - great for mobile devices
- can be used with other database transports such as mesh-http
- cascades operations to other transports
installation
npm install mesh-local-storage
var mesh = ;var localdb = ; var db = ;
db localdb(options)
creates a local meshelt database
options
- options for the local dbstorageKey
- storage key to usestore
- store to use
var db = ;
db.run(operation, options, onComplete)
runs an operation
operation
- operation to run can be:insert
,remove
,update
, orload
options
- operation specific options
insert options:
data
- data to insert. Can be an object, or an array to insert multiple
db; // insert two itemsdb; // insert one item
remove options:
query
- mongodb search querymulti
- TRUE if you want to remove multiple items (false by default)
update options:
query
- mongodb search querymulti
- TRUE if you want to update multiple items (false by default)data
- data to set - this is merged with existing data
load options:
query
- mongodb search querymulti
- TRUE if you want to load multiple items (one by default)