Reputation: 36267
I have the following filter which I am trying to test in MongoDB Compass:
{$or: ["OwedTaxes": {$regex: "$"},"OwedTaxes": {$exists: false}]}
Meaning the OwedTaxes
field contains a "$" sign or does not exist.
There is a syntax error but I don't understand what it is. What am I doing wrong?
Upvotes: 0
Views: 38
Reputation: 51240
You need to wrap each element in the array with { }
curly brace to represent a valid BSON document.
{
$or: [
{ "OwedTaxes": {$regex: "$"} },
{ "OwedTaxes": {$exists: false} }
]
}
Upvotes: 2