CouchDb and data recording

As I understand it, CouchDb never overwrites a record, but creates a new document with a new _rev. What happens in this scenario?

  • User A is reading a document
  • User B is reading the same document.
  • User A updates the document
  • User B updates the document

Are user A changes lost in this scenario?

+3
source share
1 answer

No, user B will receive error 409 instead, since the RPM will no longer match. For user B to lock his document, he will need to update the document so that he can get the latest version of the document.

This is called Optimistic Blocking and is specifically designed to prevent the problem you are seeing.

B User A, , _rev.

+6

All Articles