Monk defines the id
and oid
(alias) methods for casting to ObjectID
:
users.id() // returns new generated ObjectID
users.id('hexstring') // returns ObjectId
users.id(obj) // returns ObjectId
Though it seems capable of working with the string as well:
users.findById('hex representation', function(err, doc){});
users.findById(oid, function(err, doc){});