IN nodejs, with mongodb, mongoosejs as orm
I am doing this
I have a model, User
User.findOne({username:'someusername'}).exec(function(err,user){
console.log(user) //this gives full object with something like {_id:234234dfdfg,username:'someusername'}
//but
console.log(user._id) //give undefined.
})
Why? And how to get the _id to string then?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…