Update Mongoose

20 views
Skip to first unread message

graydi...@gmail.com

unread,
May 2, 2019, 5:52:14 PM5/2/19
to Mongoose Node.JS ODM


Hello,
I am new to the forum. I write because i have a problem when i run the update. 

                       Utenti.updateOne({ username: 'GreyDiamond' }, { online: true, token: token }, function(err, res) {
                           if(err){
                               console.log("error update");
                           }else{
                               console.log("update ok");
                           }
                         });

If the user "GreyDiamond" has already the field "token" with the value, with this updateOne, does not override the value, but append the new value on the old value.  Can anyone tell me why? Thanks 

graydi...@gmail.com

unread,
May 2, 2019, 6:16:07 PM5/2/19
to Mongoose Node.JS ODM
I have solved. thanks a lot
Reply all
Reply to author
Forward
0 new messages