Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
3.0.4
-
None
-
Query
-
ALL
Description
> db.version();
|
3.0.4
|
Example document:
{
|
_id: "...",
|
foo: {
|
bar: [ 1, null, 3, 4 ],
|
baz: [ { value: 1 }, { value: null }, { value: 3 }, { value: 4 } ]
|
}
|
}
|
I want to remove all values that are $lt: 4 or null. To simplify thing I wanted to use $not: { $gte: 4 }.
This works:
update(
|
{},
|
{ $pull: { 'foo.baz': { 'value': {$not: { $gte: 4 } } } } }
|
)
|
And this does not work:
update(
|
{},
|
{ $pull: { 'foo.bar': { $not: { $gte: 4 } } } }
|
)
|
It gives the following error:
"writeError" : {
|
"code" : 2,
|
"errmsg" : "unknown top level operator: $not"
|
}
|
Am I doing something wrong or is there another way to do this?