U kunt qTyIn
. vergelijken met undefined
binnen $filter
:
db.collection.aggregate([
{
$addFields: {
transactions: {
$filter: {
input: "$transactions",
cond: {
$ne: [ "$$this.qtyIn", null ]
}
}
}
}
}
])