Here's my data:
{
foos: [
{ _id: 1 },
{ _id: 2 },
{ _id: 3 }
],
bar: "baz"
}
Now I wanna move field bar into foos object with _id = 2 to have this:
{
foos: [
{ _id: 1 },
{ _id: 2, bar: "baz" },
{ _id: 3 },
]
}
How can I do this using aggregation framework?