i have an embedded document within a document as following :
{
user:"Alex",
actions: {
openFav:8,
clickShare:5
}
}
So what i need is to move the embedded document actions one level up and have them in different collection (so i could do a quick stats report).
So the end result will look like this :
{
user:"Alex",
openFav:8,
clickShare:5
}
how could i do this in mongodb javascript shell ?
Copy the properties using a
for...inloop, then deleteactions: