jeudi 26 février 2015

how Update an item in an array that is in an array in mongoose

I have a document in a mongodb collection like this :



{
id: String,
username: String,
password: String,
email: String,
user_messeges: [{
mail:String,
messeges:[ {String} ]
}]
}


And i want to update messeges array in user_messeges array.


i used this mathod but i got error: "The positional operator did not find the match needed from the query. Unexpanded update"



User.update({'user_messeges.email':my_email},{$push : {'user_messeges.$.messages':msg}},{upsert:true},function(err)...


How can I do this ?


Thanks for help.


Aucun commentaire:

Enregistrer un commentaire