pouchdb-derived-database
A utility to make it easy to create PouchDBs whose documents arbitrarily reflect those on a primary database.
In fact it is just a changes listener wrapper.
Usage
npm install --save pouchdb-derived-database
var PouchDB = var upsert = upsertPouchDB var db = 'primary-db' db // `stats` is just a normal pouch database// it can be accessed anywherevar ddb = 'stats' // you add documents to the primary database, they get reflected on the secondarydb // prints 35
Other things
- This plugin only adds a
.setDerived
method on all PouchDB databases. - When the primary database is destroyed, all its derived databases are destroyed too.
- I recommend that you never update the primary database inside a derivation function. Please.