Store and read object patches (with metadata) in insert order. Based on level-patch-data.
var assert =var Pouch =var Patch =var db =var patch =patch
See tests for more examples.
db: an instance of
pouchdbto store patches and data.
opts.namespaceField: the field to use to store the
opts.patchField: the field to use to store the
namespace: the string to identify this collections of patches. This module is designed for use with patcher patches for a single object per unique
patch: the object to store as the patch
meta: key/value pairs to store with this patch. Note: the keys
opts.patchFieldwill be overwritten if set.
callback: receives two arguments,
errwhich is only set if an error occurs and
commit, which is the patch and its metadata exactly as it was saved.
Callback is called with any error and a list of commits in insert order.
namespace: the collection of patches to read. patches will be streamed in the order inserted.
since: optional. pass the
_idof the commit to read commits since. The commit with
_id === sincewill not be returned, only all commits after it.