Consider the following models:
User:
id: ObjectID
Group:
id: ObjectID
users: []
If I had a group collection like:
Group = [{
id: 1,
users: [1,2,3,4,5]
},
{
id: 2,
users: [1,6,7]
}
]
How could I get all the Groups
that container the User ID 1
in the groups.users
array?