I\'m using a node.js and mongodb, and I\'m trying to query the database based on the mongo generated ID using the following:
collection.findOne( {_id:doc
The MongoDb is an object not a string. To convert my string I used:
var id = require('mongodb').ObjectID(doc._id);
This converts my string into a mongo ObjectId and matches the _id in the db!