I have a list like this:
{
arr: [
{ _id: 'a', val: 1 },
{ _id: 'b', val: 4 },
{ _id: 'd', val: 0 },
{ _id: 'c', val: 8 }
]
}
And I need to put the element {_id: c}
before the element {_id: d}
. How can I do it with mongo? Of course, I can download the doc to my server, prepare it and upload the one to the mongo server. But I think, it's not a good way.
P.S: sorry, I need to move the element (push it to a new position and remove the one from old position)