Why I have "undefined" "undefined" in my console? How to get my new data after findOneAndUpdate?
CollectionName.findOneAndUpdate({'user.id': id}, {$set:{data: { nickname: req.user.nickname, id: userid }}}, function(err, doc){
if(err){
console.log("Something wrong when updating data!");
}
if (doc) {
console.log(doc.data.id);
}
console.log(doc.data.id);
});
via Bim Bam
No comments:
Post a Comment