pouchdb / upsert

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

remove cloning and _rev removal, add tests #4

Closed nolanlawson closed 9 years ago

nolanlawson commented 9 years ago

My proposed version of https://github.com/pouchdb/pouchdb-upsert/pull/3.

As it turned out, I didn't even need pouchdb-extend for cloning, because the tests can pass without any cloning, which is a win for performance.

I also decided to formalize how I think the _rev/_id system ought to work:

I think this is the most logical, given that you're seeing the object exactly as it was get()ted from the database (except in the case of {}, which is a little odd but still acceptable IMO).