I have want to go from this document:
{
_id: 1,
property: "a",
children: [
{ _id: 2, property: "b" },
{ _id: 3, property: "c" }
]
}
to this:
{ _id: 1, property: "a" }
{ _id: 2, property: "b" }
{ _id: 3, property: "c" }
using a MongoDB aggregate function. I have not found anything suitable. $unwind comes the closest, but doesn't quite lead to the desired result.