Puoi usare $match e $replaceRoot per restituire solo il sotto-documento desiderato.
db.test.aggregate([
{ $match: { "house.room.bed": "bed_blue" } },
{ $replaceRoot: { newRoot: "$house.room" } }
])
Puoi usare $match e $replaceRoot per restituire solo il sotto-documento desiderato.
db.test.aggregate([
{ $match: { "house.room.bed": "bed_blue" } },
{ $replaceRoot: { newRoot: "$house.room" } }
])