How to write select statement for serialize document?


#1

I am using SerializableDocument to serialize PriceInvRspRow object to couchbase.

Using below code:

Now when I am retrieving this document using N1QL what I’ll give in select statement?

Thanks in advance,


#2

@varshasahu you can’t … N1QL only works with JSON, so you need to use the JSON document variants if you want to use N1QL (or Views for that matter). If you use the serializable document you can use all the KV methods provided.


#3

Thanks Michael,

What are the KV methods?

Thanks in advance.


#4

With N1QL, you have the following 2 features.

This will retrieve a counter b:

SELECT RAW b FROM mybucket b;

This will retrieve a BASE64 encoded binary value:

SELECT BASE64(b) FROM mybucket b;

And as @daschl pointed out, Couchbase client APIs provide key-value (KV) GET / SET and other methods.


#5

Thanks Gerald and Michael.