try catch converting id to object id

This commit is contained in:
Henry Oswald 2014-11-09 23:08:23 +00:00
parent 6d10e45135
commit e9232eb197

View file

@ -8,7 +8,10 @@ module.exports = UserGetter =
callback = projection callback = projection
projection = {} projection = {}
if typeof query == "string" if typeof query == "string"
query = _id: ObjectId(query) try
query = _id: ObjectId(query)
catch e
return callback(null, null)
else if query instanceof ObjectId else if query instanceof ObjectId
query = _id: query query = _id: query