0

I am building an ElectronJS app and storing a list of documents locally using PouchDB. I am using the pouchdb-upsert for inserting new records. It is also creating revisions in the database and I can see them nicely.

PouchDB data screen capture

Problem is that I cannot fetch a specific revision using db.get or a batch of them using db.bulkGet following PouchDB's documentation. In both cases I get a 404 error from the database.

I need to be able to obtain the list of revisions as PouchDB documents so users be able to maintain a history of their documents as they edit them or fork a revision as a new document when needed. Similar to the google docs history feature. How can I obtain the list of revisions created by the upsert plugin?

user3833490
  • 15
  • 1
  • 6

1 Answers1

0

You can use some options while fetching a document to get a list of all revisions:

db.get(docId, [options], [callback])
...
options.revs: Include revision history of the document.
...

Also take a look at this related answer.

Megidd
  • 7,089
  • 6
  • 65
  • 142