In N1QL you can see xattrs using the meta() function. It needs to be covered so we need to create an index first. For eg -
create index id2 on default(c1,meta().xattrs._sync,c2).
With the explain we should get -
“expr”: “cover ((meta(default).xattrs._sync))”
select c1,meta().xattrs._sync,c2 from default where c1=5;
Should give something like this -
{
“_sync”: ,
“c2” : 3
}
If you need to explicitly select something within _sync you can specify that.
select c1,meta().xattrs._sync.rev,c2 from default where c1=5;
I went the n1ql route and the following query returns the latest revision:
SELECT meta().xattrs._sync.rev FROM <my_bucket> USE KEYS '<my_doc_id>';
The goal is to delete an attachment of a document. This SG REST API method [1] does not support removing an attachment but there is an open issue on Github [2]. To update the document and attachment I went with this method [3] which needs a revision as parameter. I believe with the above n1ql query the latest revision of the doc is returned. That is the revision I need to get the job done.