Couchbase N1QL: how to get a complete document, including ID and CAS using SELECT

I am using Couchbase 4.0 beta with java-client 2.1.3.

Bucket.get(id)returns JsonDocumentfrom which I can get idboth cas, and also the contents. Now I want to query secondary indexes with N1QL (select *). However, QueryResultreturns strings JsonObjectthat are only the contents of the document. In any case, I can get the metadata ( idand cas) too?

+4
source share
1 answer

You can do the following:

SELECT b, meta(b) AS meta FROM my_bucket b;
+6
source

All Articles