PinkiePie
06/23/2022, 6:35 PMdb.Game.aggregate([{
$match: {
$expr: {
$and: [{
$in: ["$_id", [ObjectId("62b456c7548b0f401c499f49"), ObjectId("62b456e21955d39f37f9e45c"), ], ],
}, {
$or: [{
$ne: [{
$ifNull: ["$_id", null, ],
}, null, ],
}, {
$eq: ["$_id", null, ],
}, ],
}, ],
},
},
}, {
$project: {
_id: 1,
name: 1,
},
}, ])
_id
is a mandatory field, so it can't be null
, but we have a huge branch for it:
$or: [{
$ne: [{
$ifNull: ["$_id", null, ],
}, null, ],
}, {
$eq: ["$_id", null, ],
}, ],
Vladi Stevanovic
PinkiePie
07/11/2022, 4:03 PMNurul
07/19/2022, 1:29 PM$runCommandRaw
method.