I want to update in Mongo
the 'order' field to all of my documents so they will be 1..2..3..4....34.
After running this, they all have "order": "34". What am I doing wrong?
var i = 1;
db.images.find().forEach(function() {
db.images.update(
{},
{ "$set": {"order": NumberInt(i)} },
{ multi: true }
);
i++;
})