I’m using the following specification in $project
but I’ve to use field: 1
to retrieve the fields that I want in the final document but instead what I want is to do is include all the fields in the final document.
{
"newField": {
"$filter": {
"input": "$example",
"as": "example",
cond: {
"$and": [
{"$eq": ["$$example.id", "1234"]}
]
}
}
},
}
Output:
{
_id:ObjectId("5f4d78952ebfba2559305679")
example: [{_id:: 12314}]
}
Is there any way to retrieve all the fields?
Thank you so much.