I want to update xattr in meta of a document. I didnt find any document provided by couchbase.
{
"meta": {
"id": "0000c84b-e2bc-43ac-af51-7cf141777f49",
"rev": "102-163756db3f7100000000000002000000",
"expiration": 0,
"flags": 33554432,
"type": "json"
},
"xattrs": {}
}
Can anyone help me.
To update XATTR, use the Sub-Document API. Here's an example from the Couchbase Java documentation:
JsonObject docContent = JsonObject.create().put("body", "value");
collection.mutateIn("hotel_14006",
Arrays.asList(MutateInSpec.upsert("foo", "bar").xattr().createPath(), MutateInSpec.replace("", docContent)));
Notice the use of .xattr()
.
Note that XATTR's generally should only be used for framework/library metadata, and are not meant for use in general applications. XATTRs may not be accessible by all Couchbase services (Search, for example).