pouchdb / upsert

PouchDB plugin for upsert() and putIfNotExists() functions
Apache License 2.0
149 stars 25 forks source link

Documentation issue: `upsert` returns `id` and `rev`, without underscores #54

Closed fasiha closed 7 years ago

fasiha commented 7 years ago

The docs assert that upsert returns {_id, _rev} (and potentially other things). I see that currently it returns id and rev, without underscores. I can submit PR to correct this if indeed the docs are wrong? Thank youuu!

chorpler commented 7 years ago

I think you might be misunderstanding the docs -- upsert returns an object telling whether the document was updated or not, plus the id and revision, in the format:

{updated: true, rev: "2-b5e14bb0396dc9b7d34db8867156a6c2", id: "documentID"}

Of course, the document in the database will have _id and _rev and whatever other fields. But that's not what is actually returned by upsert.

fasiha commented 7 years ago

Aha! Understood!!!