I have the following query that I need to find the reverse.
db.contracts.aggregate([
{ $match: { currentBalance: { $gt: 0 }, status: 'open' } },
{ $project: { customer_id: 1, lastTransactionDate: 1, currentBalance: 1, status: 1 } }
])
I an trying not to use
$or: [ currentBalance: { $ne: 0 }, status: { $ne: 'open' } ]
What I would really like is to use $not: [ condition ] as I will have more difficult aggregations to write. However I cannot find the right syntax. Any help appreciated. I am using mongodb 3.0.7
$ne? Is your condition going to be an array? If so, use$nindocs.mongodb.org/manual/reference/operator/query/nin