I have documents in my collection similar to foo. These documents can have a nested parent object which also can have a nested parent object and so on..
foo: {
caption: "Italian",
code: "",
id: 17,
parent: {
caption: "Restaurants",
code: "",
id: 9,
parent: {
caption: "Food and Drink",
code: "food_and_drink",
id: 1,
parent: ""
}
}
};
How can I search for a mathch in foo.parent.id and all it's nested parent objects (if there are any)? Should I use $in? Recursively?