pouchdb / upsert

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

upsert ignores fields that don't exist in the doc #26

Closed jorfermo closed 7 years ago

jorfermo commented 8 years ago

For instance this object:

{ _id: 1, name: 'a', }

upserted with this object:

{ _id: 1, name: 'aa', surname: 'b' }

result:

{ _id: 1, name: 'aa', }

and it ignores surname

Is this the expected behavior? How to upsert with new properties?

nolanlawson commented 8 years ago

I would double-check your code that you are returning the new document inside of the delta function – pouchdb-upsert should definitely support this case.

jorfermo commented 8 years ago

It's weird cause after I manually added those properties to the object in the database the upsert worked fine without touching anything in my code

nolanlawson commented 7 years ago

Please reopen if you can provide a test case to reproduce; I'm closing old issues. Thanks!