@ppliatsik I’m pretty sure what you want is compare and swap (cas). On every get, the Document has the cas value set automatically. When you then call bucket.replace() with the new document, the server will only allow it to pass when the cas on the server side is the same you automatically pass in. If not, you’ll get a CASMismatchException and then you can implement a “do/while” loop, rinse and repeat.
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Update and fetch document (for Concurrent requests) | 4 | 1663 | January 23, 2018 | |
| How to get CAS value while performing an update using couchbase subdocument api? | 3 | 2454 | July 30, 2019 | |
| Concurrent update to the same document can get lost | 3 | 1953 | August 25, 2017 | |
| N1ql concurrency issue while updating a document to provide unique document to users | 4 | 890 | January 22, 2021 | |
| Java sdk client cas help | 15 | 2801 | May 8, 2017 |