Reputation: 293
I'm trying to get all documents that don't have an _id
in the array excluded
.
db.sites.find({ "$expr": { '_id': { "$not": { "$in": "$excluded"} } } });
I'm not using $nin
because it's not allowed under $expr
.
I'm getting the following error message:
Error: error: {
"ok" : 0,
"errmsg" : "Expression $in takes exactly 2 arguments. 1 were passed in.",
"code" : 16020,
"codeName" : "Location16020"
}
Can I use $where
for this instead?
Upvotes: 2
Views: 1252