I have a schema that's something like this
firstfield :{
secondfield:{
thirdfield : [ObjectId]
}
}
and i do something like this
models.mymodel.update({_id:ObjectId(logId)}, {$push: {"firstfield.secondfield.thirdfield" : ObjectId(userId)}}, function(err, result) {
console.dir(result);
})
Here's the problem. When i give it an existing logId to search for... after it's done, it deletes the whole row.. and creates another one, somehow managing to increment SOME fields (let's assume i have name field set as : mylog_6 (the current row i want to modify) and the maximum is 105.. it will delete that row and create one and it will set the name as mylog_106.
What gives? :)