Accessing XATTR in Spring Data Couchbase

I am trying to find a way to get the document revision ID but I can’t see any way to access it using spring data. Do I need to drop back to the java SDK to do that?

I need it in order to post a series of attachments to the object via Sync Gateway attachments PUT. I’ve tried adding a If-Match header with no luck (it doesn’t seem to be working for me?" and looking into the viability of using the revision ID.

Given the revision will change every time I post a file, I assume I need to re-fetch it each time I send a file?

Hi Ben -
I think you want to use the CAS for this?


Is that correct? The CAS can be loaded into your entity object in the field annotated with @Version.
When the document is replaced, the CAS in the entity (if there is one) should be* compared with the CAS in the document to ensure that there have been no intervening updates.

should be* - I just checked and this isn’t implemented yet https://jira.spring.io/browse/DATACOUCH-595

  • Mike

nah, we need the sync revision ID: https://docs.couchbase.com/sync-gateway/2.7/rest-api.html#/attachment/put__db___doc___attachment_