Use last revision for each document on a bulk update

Is there a way to update multiple documents via an admin rest api bulk docs update that doesn’t require specifying the revision for each document? I would have to check each document first for its last revision and that seems like unnecessary work for my API. Am I missing something?

You will have to specify a revision Id every time you update a document (That includes deletions or edits).
To elaborate more on why thats the case - Couchbase uses Multi Version Concurrency Control (MVCC) system to store documents as a revision tree - so every update results in a new revision. So if you are updating a document, you will have to explicitly specify the revision that you are updating.

The expectation is that if you are updating a document, you would have to anyway fetch the latest version of the document and then edit the same . Failure to update the latest version can potentially result in conflicts because you could be updating an older version of the document (because someone else could be doing a concurrent update on that same version) . You can learn more about conflicts here.

I am aware of this. I was expecting it to work like the update method on a single document here

If the document already exists, the document is updated with the JSON document in the message body and given a new revision.

That line just means that a PUT will update an existing revision. It does not mean that you don’t have to provide a revision Id.
You will still need to provide the “rev” parameter when updating a single document. It is optional only when you are creating a new one.
FYI -There is the “new_edits” parameter that you could set to false to just update the body of an existing revision (But you would still have to provide the revisions )

My bad. Thank you very much for taking the time to respond to my misunderstanding :slight_smile:

No worries . You are welcome :slight_smile: