I’m testing this on mongoplayground. Why are these 2 queries return different results?
-
First query
db.collection.find({ "key": { $gte: 88 } })
-
Second query: reverse the condition with
$not
db.collection.find({ "key": { "$not": { $lt: 88 } } })
Normally, when the field is an array, only one element match is enough for array match. However, in this query, it seems that every array element needs to be matched for array match.
My sample dataset:
[
{
"key": [
87,
88
]
},
{
"key": [
88,
89
]
},
{
"key": [
86,
90
]
},
{
"key": [
93,
89,
71
]
}
]