Open
Description
Rafal Glowinski opened DATAMONGO-1897 and commented
Having a simple MongoDB document that contains an array:
{
"type": "SOME_TYPE",
"permissions" : ["A", "B", "C"]
}
I would like to find all documents that match this MongoDB query:
{ "type": "SOME_TYPE", "permissions": { $elemMatch: { $eq: "B" } } }
Currently, I have to use this construct:
Criteria.where("type").is("SOME_TYPE").and("permissions").elemMatch(new Criteria().in("B"))
which translates to:
{ "type": "SOME_TYPE", "permissions": { $in: ["B"] } }
What is missing, in my opinion, is a method 'eq' on Criteria, that would let us write:
Criteria.where("type").is("SOME_TYPE").and("permissions").elemMatch(new Criteria().eq("B"))
Attachments:
- DATAMONGO-1897.patch (3.02 kB)