I put binary data in Couchbase. But for my new use case, I need to set a field called created_date along with my document. I was thinking of using xattr for this.
The purpose of this field "created_date" will be to use it for comparison between two versions of the same document (let's say doc_1)
For e.g.
doc_1 - created_date1 - In couchbase currently
doc_1 - created_date2 - Received from upstream
And I need to compare created_date2 vs created_date1 and replace the upstream document in Couchbase only if created_date2 > created_date1 .
I am using Java SDK for Couchbase. I was using upsert for inserting/updating in Couchbase which supports transcoder for non-JSON documents in UpsertOptions.
UpsertOptions upsertOptions = UpsertOptions.upsertOptions()
.transcoder(transcoder)
But for setting Xattr I think I must use
collection.mutateIn
as MutateInSpec supports xattr
MutateInSpec.replace("created_date", created_date).xattr())
But I am not able to find an option to specify transcoder in
MutateInOptions.mutateInOptions()
Any help will be appreciated.