Reputation: 3560
Given the below example record, how can I find all users that belong to at least one group from an arbitrary set of groups to query against? For example, find all users that belong to any one of the following groups - 1, 10, 43. I'm looking for a generalized solution. I know I can build out an or query but is there a more efficient way to handle this?
> db.users.findOne()
{
"_id" : ObjectId("508f477aca442be537000000"),
"name" : "Some Name",
"email" : "[email protected]",
"groups" : [
1,5,10
]
}
Upvotes: 0
Views: 295