I've been struggling for hours. Here's what I need to achieve: find if document exists where both conditions are satisfied: Field1 = 'Value1' and users.userName = 'Value2'
{
"_id": "eRotXZoKL4aS3KygF",
"Field1": "Value1",
"usercount": 1,
"owner": "Admin",
"accessType": "Level1",
"users": {
"userName": "Value2",
"expired": false
}
}
My query
Collection.findOne({},{Field1: channel, users:{userName: nickName}});
returns first match it finds. In other words, it finds the document where users:{userName: 'Value2'}, but disregards, or so it seems Field1: 'Value1'