Closed
Description
A further discussion of #54 (comment)
Regarding
When I step back a bit and look at the problem from a high level perspective, then I think it should be acceptable to require callers of patch/replace operations to provide _rev in the data, as that's the way how CouchDB/Cloudant allows clients to detect and resolve conflicts
Our current implementation:
Now whenever rev
is needed, eg: in function Cloudant.prototype.delete()
, Cloudant.prototype.replaceById()
, we call getCurrentRevision()
.
But considering the nature of Cloudant db, we should ask the caller to provide rev
, and return error if it's missing.
Affected functions:
- updateOrCreate
- PATCH Models/
- Provide rev when updating an existed instance with
data: {rev: rev_of_new_data}
- replaceOrCreate
- PUT Models/
- Provide rev when replacing an existed instance with
data: {rev: rev_of_new_data}
- save
- need to investigate
- replaceById
- Provide rev when replacing an existed instance with
data: {rev: rev_of_new_data}
- Provide rev when replacing an existed instance with
- delete
- DELETE Models/
- We disabled this endpoint and DELETE Models/{id} doesn't accept data...any idea? Probably keep our current design.