I wonder if it will evaluate the parent within the '$ or' statement or the one (key / value), what takes precedence or what is the expected behavior and why?
db.collection.find({
parent: '2kzW57uhwthPFNyB9',
access: null,
'$or': [ { owner: 'PBjjLpK9fQi4qyTd4' },
{ parent: { $in: ['2kzW57uhwthPFNyB9', '6we357uhwthPFwerr'] } } ]
})
{
parent: '2kzW57uhwthPFNyB9',//condition1
access: null,//condition2
'$or': [
{
owner: 'PBjjLpK9fQi4qyTd4'//condition 3.0
},
{
parent: {//condition 3.1
$in: [
'2kzW57uhwthPFNyB9',
'6we357uhwthPFwerr'
]
}
}
]
}
It is and condition when you specify comma separated conditions in find.
You have 4 conditions as I named above.
It works like condition1 AND condition 2 AND (condition 3.0 OR condition 3.1)
So no precedence.