Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couchbase N1QL: How to get complete Document including ID and CAS with SELECT

Tags:

couchbase

n1ql

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

The Bucket.get(id) returns JsonDocument from which I can get id and cas as well as the content. Now I want to query on secondary indices using N1QL (select *). However, the QueryResult only returns rows of JsonObjects which are just the document contents. Is there anyway I can get the meta data (id and cas) too?

like image 660
P T Avatar asked Jun 25 '15 18:06

P T


1 Answers

You can do the following:

SELECT b, meta(b) AS meta FROM my_bucket b;
like image 195
geraldss Avatar answered Jan 03 '23 00:01

geraldss