Saturday, 8 April 2017

Get an _id from mongoose model by name. Nodejs

Problem is - i can't define variable inside this function (console.log is working), and can't find another way how to get _id from this damn model.

 User.findOne({name: name}, function(err, user) {
    var test = user._id;
    console.log(user._id);
});



via Сергей Иванов

No comments:

Post a Comment