{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/3462","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/3462/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/3462/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/3462/events","html_url":"https://github.com/Automattic/mongoose/issues/3462","id":111275549,"number":3462,"title":"geoNear not working as expected after upgrade","user":{"login":"bardu","id":599881,"avatar_url":"https://avatars.githubusercontent.com/u/599881?v=3","gravatar_id":"","url":"https://api.github.com/users/bardu","html_url":"https://github.com/bardu","followers_url":"https://api.github.com/users/bardu/followers","following_url":"https://api.github.com/users/bardu/following{/other_user}","gists_url":"https://api.github.com/users/bardu/gists{/gist_id}","starred_url":"https://api.github.com/users/bardu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bardu/subscriptions","organizations_url":"https://api.github.com/users/bardu/orgs","repos_url":"https://api.github.com/users/bardu/repos","events_url":"https://api.github.com/users/bardu/events{/privacy}","received_events_url":"https://api.github.com/users/bardu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-13T21:31:12Z","updated_at":"2015-10-13T23:36:15Z","closed_at":null,"body":"Upon upgrading MongoDB from 2.6 to 3.0.6 and Mongoose from 3.8.x to 4.1.11 the following query did always worked:\r\n```javascript\r\nfunction findData(req, res) {\r\n    var point       = { type : \"Point\", coordinates : [+req.body.lng, +req.body.lat] },\r\n        maxKm       = 480,\r\n        earthRadius = 6371,\r\n        maxDistance = maxKm / earthRadius;\r\n    // get all campgrounds within 300mi/480km from the users position \r\n    Campgrounds.geoNear(point, { maxDistance: maxDistance, spherical: true }, function(err, results, stats) {\r\n        if ( err ) {\r\n            console.log(err);\r\n            res.send([]);\r\n        }\r\n        if ( results.length === 0 ) {\r\n            console.log('No campgrounds within 480 km');\r\n            res.send([]);\r\n        }\r\n        else {\r\n            res.send(results);\r\n        }\r\n        \r\n    });\r\n}\r\n```\r\nNow results.length is 0.\r\n\r\nI could not find any hints to API changes, are there any?\r\n"},"comment":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/comments/147884557","html_url":"https://github.com/Automattic/mongoose/issues/3462#issuecomment-147884557","issue_url":"https://api.github.com/repos/Automattic/mongoose/issues/3462","id":147884557,"user":{"login":"vkarpov15","id":1620265,"avatar_url":"https://avatars.githubusercontent.com/u/1620265?v=3","gravatar_id":"","url":"https://api.github.com/users/vkarpov15","html_url":"https://github.com/vkarpov15","followers_url":"https://api.github.com/users/vkarpov15/followers","following_url":"https://api.github.com/users/vkarpov15/following{/other_user}","gists_url":"https://api.github.com/users/vkarpov15/gists{/gist_id}","starred_url":"https://api.github.com/users/vkarpov15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkarpov15/subscriptions","organizations_url":"https://api.github.com/users/vkarpov15/orgs","repos_url":"https://api.github.com/users/vkarpov15/repos","events_url":"https://api.github.com/users/vkarpov15/events{/privacy}","received_events_url":"https://api.github.com/users/vkarpov15/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T23:36:15Z","updated_at":"2015-10-13T23:36:15Z","body":"See http://docs.mongodb.org/manual/reference/command/geoNear/, it looks like the MongoDB server uses meters to compute distance if you pass a geoJSON point and radians if you use legacy coordinate pairs. I'm not 100% sure if this was changed in MongoDB 3.0.x but that would explain the behavior you're seeing - try removing the earthRadius division."}}