Reputation: 930
I have the following document
{ "std_name": "Abcd", "tags": ["tag1", "tag2", "tag3"] },
{ "std_name": "Wxyz", "tags": ["tag4", "tag1", "tag3"] },
{ "std_name": "Demoname", "tags": ["tag4", "tag2", "tag3"] },
where i have to select all documents with tag2 i tried with criteria as follow but returns null
1.Criteria.where("tags").is("tag2")
2.Criteria.where("tags").all("tag2")
how to get the result.
Upvotes: 0
Views: 40
Reputation: 1001
You can use in function to select all document having tag2.
Criteria.where("tags").in(Arrays.asList("tag2"));
Upvotes: 1