I have object with column chars with such data:
{
"chars": [
{
"count": 1,
"color": "red"
},
{
"count": 2,
"color": "green"
},
{
"count": 3,
"color": "blue"
}
]
}
I want to exclude records with chars like
{"count": 2, "color": "blue"}
I filter by (demo1)
{
"$or": [
{
"chars.count": {
"$ne": 2
}
},
{
"chars.color": {
"$ne": "blue"
}
}
]
}
or (demo2)
{
"chars.count": {
"$ne": 2
},
"chars.color": {
"$ne": "blue"
}
}
I want to receive object, but receive empty set.
I use MongoDB 6.0.6
charsin the projection? Should be filter 2 not 3 according to your question?charswith all objects in it, because I haven't{"count": 2, "color": "blue"}