0.6.8 • Published 7 years ago

@rappopo/dab-pouch v0.6.8

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

@rappopo/dab-pouch

A Rappopo DAB implementation for PouchDB.

Installation

Simply invoke this command in your project folder:

$ npm install --save @rappopo/dab-pouch

And within your script:

const DabPouch = require('@rappopo/dab-pouch')
const dab = new DabPouch({
  path: '/home/me/pouchdb'
})
// prepare collections
dab.createCollection({ name: 'test' })
  .then(result => {
    return dab.bulkCreate(data, { collection: 'test' })
  })
...
// lets dab!
dab.findOne('my-doc', 'test').then(function(doc) { ... })

Options

path: the path where all PouchDB folder will be saved and reside. If it not provided, it'll defaults to /tmp

retainOnRemove: array of columns to retain when a document is deleted. Default: [].

When PouchDB delete a document, it actually PUTs a document with content like this:

{
  "_id": "<doc_id>",
  "_rev": "<rev_id>",
  "_deleted": true
}

But sometimes you want to also have some columns to be put on that deleted document. The retainOnRemove simply left those columns intact, e.g:

{
  "_id": "<doc_id>",
  "_rev": "<rev_id>",
  "_deleted": true,
  "type": "<mytype>"
}

Features

Donation

  • Donate
  • Bitcoin 16HVCkdaNMvw3YdBYGHbtt3K5bmpRmH74Y

License

MIT

0.6.8

7 years ago

0.6.7

7 years ago

0.6.6

7 years ago

0.6.5

7 years ago

0.6.4

7 years ago

0.6.3

7 years ago

0.6.2

7 years ago

0.6.1

7 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.0.9

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago