mongo console find by id
db.collection.find({_id:ObjectId('5e208c18d598b806c869ca37')}).pretty()
mongo console find by id
db.collection.find({_id:ObjectId('5e208c18d598b806c869ca37')}).pretty()
mongodb js get id of inserted
collection.insert(objToInsert, function (err, result){
if(err)console.log(err);
else {
console.log(result["ops"][0]["_id"]);
// The above statement will output the id of the
// inserted object
}
});
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us