Cradle automatically disarms CouchDB failsafe (conflict management) on .save() #207

Closed
wants to merge 2 commits into
from

Projects

None yet

6 participants

@sreuter
Contributor
sreuter commented Feb 28, 2013

CouchDB leverages revision ids to assure a document nerver gets accidentally overwritten. On each update, the app logic must be aware of the previous revision id to update a document. Cradles .save() implementation completely disables this functionality, by automatically fetching the current documents revision id when a conflict occurs.

@sreuter
Contributor
sreuter commented Mar 4, 2013

@indexzero Any opinion on this one? By the way, the documentation also states that the _rev is need to update a single doc. Right now, this is not the case...

@sreuter
Contributor
sreuter commented Mar 11, 2013
@barnabyc

This issue came up for us today as well. Would be interested to hear rationale for this approach before I create a workaround on our end.

@indexzero
Member

This needs to be an option enabled by default. It's one of the reasons cradle is a "high-level" library for CouchDB and not "a literal and fraglie" library for CouchDB.

@tbasse
tbasse commented Mar 27, 2013

Okay, now at least there's an explanation for cradles behavior.

But - and it's a huge but - as it clearly breaks the way how saving documents are meant to work in CouchDB you really have to address this in your README in a prominent way. Even with an option that defaults to to the current way you have to be absolutely clear about that cradle is not acting like what you expect from CouchDB here.

@ahizzle
ahizzle commented Apr 3, 2013

Just stubbed my toe on this as well. This behaviour is totally 'un-CouchDB'. :(

@nisaacson
Contributor

Is this behavior configurable? I just wasted good deal of time with this problem

@barnabyc
barnabyc commented Apr 4, 2013

We're all free to add this config option (fork and create a pull request); I'll open one in the next couple days unless one of you does first.

@sreuter sreuter closed this Feb 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment