Answer the question
In order to leave comments, you need to log in
How to move an element in an array (mongodb)?
Good afternoon! I have a document:
{ arr: [{ _id: 'a', val: 1 }, { _id: 'b', val: 4 }, { _id: 'd', val: 0 }, { _id: 'c', val: 8 }] }
Answer the question
In order to leave comments, you need to log in
$pull and $push
$pull - obviously.
and $push is something like this:
$push: { "items" : { $each : [ "item" ], $position : 1 } }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question