Does Moongoose 3.8.8 (the lastest version) support $position (http://docs.mongodb.org/manual/reference/operator/update/position/) operator from MongoDB 2.6.0?
In the following code the new elements is inserted in the end of the array userActivity.activitie
var userActivity = new schema({ userId: {type:String, required:true, unique:true}, activities: [activity] }); var activity = new schema({ act: {type: Number, required:true}, });
var activity = { act: 1 };
model.userActivity.update(
{ _id: dbact._id },
{ $push: { activities: {
$each: [ activity ],
$position: 0
}
}
},
function (err, numAffected) {
if (!err) {
// do something
}
});
It seems that $push together with $position doesn't work (I use the latest MongoDb 2.6 and the latest Mongoose 3.8.8) - the $position operator is ignored and new element is inserted in the end of array!
What am I doing wrong?