Reputation: 1432
I want to search for element with key-value from array element section of the document. Lets say i have json looks like -
{
"name":"abc",
"lastName":"xyz",
"description":"aaaaa aaaa",
"dob":11-10-1988,
"workInformation":[
{
"address":"kolkata",
"workFor":"vvv Pvt Ltd"
},
{
"address":"bangalore",
"workFor":"www Pvt Ltd"
}
]
}
Lets say i want to search using java api inside array property workInformation for below mentioned key and value -
key - workFor, value - vvv Pvt Ltd
Please let me know, how to do it.
Thanks for reading.
Upvotes: 2
Views: 194
Reputation: 2475
One easy way is to use StructuredQueryBuilder.value. For example:
StructuredQueryBuilder sqb = new StructuredQueryBuilder();
QueryDefinition query = sqb.value(sqb.jsonProperty("workFor"), "vvv Pvt Ltd");
Another option is to use QBE.
Upvotes: 6