I am using Couchbase 3.2 SDK, to query couchbase server. Like below
QueryResult result = cluster.query(
"SELECT *, Meta().id FROM bucketName USE KEYS ?",
queryOptions().parameters(JsonArray.from("pk")).readonly(true));
The response is like
[{"id":"pk","bucketName":"<binary (21 b)>"}]
My Document is a byte[], How can I get byte[] from the query response. I have tried
- parsing to custom object by doing
result.rowsAs(CustomClass.class)
- Also tried
for (JsonObject row : result.rowsAsObject()) { resposne.put((String) row.get("id"), ((String)row.get("ratingsAndReviewCollection")).getBytes("UTF-8")); }
but both of them does not return the same doc that i had put.
This thread talks about this but does not give clear solution to this.