Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Missing _rev field when model strict = true causes 409 update conflict errors #4

Open
mhamann opened this issue May 16, 2015 · 0 comments

Comments

@mhamann
Copy link
Contributor

mhamann commented May 16, 2015

When calling instance.save() on an existing record, CouchDB returns a 409 Document update conflict when the model definition has the strict property set to true. It appears that BaseModel.applyProperties(data, instance) removes the _rev property because it isn't defined in the model.

I think the fix for this is figuring out a way for the DataSource to somehow inject any attached models with a hidden property to hold the _rev, because otherwise the default loopback functionality will automatically discard it. I'll look into this more as I'm able to find time.

For now, a workaround seems to be either manually adding _rev to the model's properties, and then setting _rev as a hidden property (i.e. hidden: ['_rev']), or just setting strict:false.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant