node.js - NodeJs Convert string to BSON object -


how can convert string (_id) bson object?

as driver i'm using monk.

monk defines id , oid (alias) methods casting objectid:

users.id() // returns new generated objectid users.id('hexstring') // returns objectid users.id(obj) // returns objectid 

though seems capable of working string well:

users.findbyid('hex representation', function(err, doc){}); users.findbyid(oid, function(err, doc){}); 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -