I have a collection of documents that I initially set up like this:
{
_id: "some_id",
data: [
{
_id: "_id_foo",
value: "foo"
},
{
_id: "_id_bar",
value: "bar"
}
]
}
Now, I realized I don't need the value field, so I can turn the array of objects into an array of strings ["_id_foo", "_id_bar"]. I'm trying to build a pipeline to accomplish this, but I'm failing miserably.
If it's easier, I can also create a data_new array and delete the old one later.
Thanks!
$mapfor this