Reputation: 1613
This might be more of a general querying question as I'm fairly new to databases.
If I have this document in a couchbase bucket:
{
"accId": "1234",
"operation": "test",
"response": "a response"
}
I can get the response with the code
N1qlQueryResult result = bucket.query(select("response").fromCurrentBucket().where((x("accId").eq("\""+Id+"\"")).and(x("operation").eq("\""+op+"\""))));
But if my JSON looks like this:
{
"organization": {
"accId": "1234",
"operation": "test",
"response": "a response
}
}
How would I go about getting the response?
Thanks for the help.
Upvotes: 0
Views: 180
Reputation: 1155
Couchbase stores JSON document. So it will be fetched as mentioned as below mentioned query.
select * from bucketName where organization.accId="1234" and organization.operation="test"
Upvotes: 2