I'm trying to get groups for a user only if the user is part of that group and its membership is true.
Here is the group schema
{
"isDefault": false,
"users": [
{
"membership": true,
"userId": "asd1234"
},
{
"membership": false,
"userId": "asdio21038028355"
},
{
"membership": false,
"userId": "as2398asjdhj"
}
],
"uuid": "c4vxitr33a9hb19n05iuqxlv1ycp47",
}
This is what I'm trying to get Groups for the user
Group.find({ 'users.membership': true, 'users.userId': 'asdio21038028355' })
Expected results should be an empty array but it is returning the above group as well.