Drathier
Drathier

Reputation: 14539

Optimistic locking over multiple documents

I need to update some documents at once, like a RDBMS transaction. The best way to do this for a single document in a key-value store like couchbase seems to be using optimistic locking. This would work for me. However, I need to update multiple documents at once.

I need all documents to be updated, or none. Is this possible in couchbase or some similar highly scalable database?

(by the way, I'm using Go)

Upvotes: 2

Views: 342

Answers (1)

user1697575
user1697575

Reputation: 2848

There are three approaches to resolve it:

  1. You should take another look at your key/document designs and identify if its possible to combine your multiple docs into one. Then you will be able to do a single transactional update in Couchbase.

  2. Simulate Transaction the effect can be simulated by writing a suitable document and view definition that produces the effect while still only requiring a single document update to be applied.

  3. Simulate Multi-phase Transactions to use the transaction record to record each stage of the update process

Upvotes: 1

Related Questions