Right now i have a aggregate pipeline returning the following array:
[{
"_id": 1,
"items": {
"_id": 1,
"transactions": []
}
},
{
"_id": 2,
"items": {
"_id": 2,
"transactions": [
{
"_id": "5a536dc1bc9b2113986a9047",
"price": 5.56
},
{
"_id": "5a536e1bbc9b2113986a904e",
"price": 11.56,
}
]
}
},
{
"_id": 3,
"items": {
"_id": 1,
"transactions": []
}
}]
It is possible to filter the documents where the field "transactions" in subdocument "items" is not empty. Like this:
[{
"_id": 2,
"items": {
"_id": 2,
"transactions": [
{
"_id": "5a536dc1bc9b2113986a9047",
"price": 5.56
},
{
"_id": "5a536e1bbc9b2113986a904e",
"price": 11.56,
}
]
}
}]
Is for aggregate pipeline not for query