{"action":"opened","issue":{"number":559,"created_at":"2011-10-10T10:20:18Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"The code I'm using is: \r\n\r\nLoginModel.findOne({'fbLogin.userID' : req.body.id}, function(err, doc){\r\n    //Here err is null and doc is the first (and only) object in the collection used by the LoginModel. \r\n});\r\n\r\nPlease note that req.body.id is undefined. \r\n\r\nI would expect this to thow an error. I tried the same thing using the mongo client and I get the following error: \r\n\r\n> db.logins.find({'fbLogin.userId': undefined})\r\nerror: { \"$err\" : \"can't have undefined in a query expression\", \"code\" : 13629 }\r\n\r\nThis seems like an inconsistency between mongo and mongoose. ","comments":0,"title":"using findOne() with an undefined value returns the first document and not an error","updated_at":"2011-10-10T10:20:18Z","url":"https://api.github.com/repos/LearnBoost/mongoose/issues/559","id":1862918,"assignee":null,"milestone":null,"closed_at":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/c48408b691cd85ec7795ad2cdd0a9254?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/mansona","id":594890,"login":"mansona"},"html_url":"https://github.com/LearnBoost/mongoose/issues/559","labels":[],"state":"open"},"legacy":{"number":559,"action":"opened","issue":1862918}}