I\'m trying to select a document by id
I\'ve tried:
collection.update({ \"_id\": { \"$oid\": + theidID } }
collection.update({ \"_id\": theidID }
c
I just used this code in Node.js app in controller file, and it works:
var ObjectId = require('mongodb').ObjectId;
...
User.findOne({_id:ObjectId("5abf2eaa1068113f1e")})
.exec(function(err,data){
// do stuff
})
do not forget to install "mongodb" before, and if you are using encryption of your passwords with bcrypt with "presave", be sure that you will not encrypt password after each modification of the record in DB.