{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/issues/285","repository_url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb","labels_url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/issues/285/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/issues/285/comments","events_url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/issues/285/events","html_url":"https://github.com/strongloop/loopback-connector-mongodb/issues/285","id":176236829,"number":285,"title":"\"Error: Callback was already called\" when using \"near\" filter","user":{"login":"bachirelkhoury","id":186698,"avatar_url":"https://avatars.githubusercontent.com/u/186698?v=3","gravatar_id":"","url":"https://api.github.com/users/bachirelkhoury","html_url":"https://github.com/bachirelkhoury","followers_url":"https://api.github.com/users/bachirelkhoury/followers","following_url":"https://api.github.com/users/bachirelkhoury/following{/other_user}","gists_url":"https://api.github.com/users/bachirelkhoury/gists{/gist_id}","starred_url":"https://api.github.com/users/bachirelkhoury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bachirelkhoury/subscriptions","organizations_url":"https://api.github.com/users/bachirelkhoury/orgs","repos_url":"https://api.github.com/users/bachirelkhoury/repos","events_url":"https://api.github.com/users/bachirelkhoury/events{/privacy}","received_events_url":"https://api.github.com/users/bachirelkhoury/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/labels/%23tob","name":"#tob","color":"eeeeee"},{"url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/labels/major","name":"major","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"Amir-61","id":10672146,"avatar_url":"https://avatars.githubusercontent.com/u/10672146?v=3","gravatar_id":"","url":"https://api.github.com/users/Amir-61","html_url":"https://github.com/Amir-61","followers_url":"https://api.github.com/users/Amir-61/followers","following_url":"https://api.github.com/users/Amir-61/following{/other_user}","gists_url":"https://api.github.com/users/Amir-61/gists{/gist_id}","starred_url":"https://api.github.com/users/Amir-61/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Amir-61/subscriptions","organizations_url":"https://api.github.com/users/Amir-61/orgs","repos_url":"https://api.github.com/users/Amir-61/repos","events_url":"https://api.github.com/users/Amir-61/events{/privacy}","received_events_url":"https://api.github.com/users/Amir-61/received_events","type":"User","site_admin":false},"assignees":[{"login":"Amir-61","id":10672146,"avatar_url":"https://avatars.githubusercontent.com/u/10672146?v=3","gravatar_id":"","url":"https://api.github.com/users/Amir-61","html_url":"https://github.com/Amir-61","followers_url":"https://api.github.com/users/Amir-61/followers","following_url":"https://api.github.com/users/Amir-61/following{/other_user}","gists_url":"https://api.github.com/users/Amir-61/gists{/gist_id}","starred_url":"https://api.github.com/users/Amir-61/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Amir-61/subscriptions","organizations_url":"https://api.github.com/users/Amir-61/orgs","repos_url":"https://api.github.com/users/Amir-61/repos","events_url":"https://api.github.com/users/Amir-61/events{/privacy}","received_events_url":"https://api.github.com/users/Amir-61/received_events","type":"User","site_admin":false}],"milestone":null,"comments":10,"created_at":"2016-09-11T10:19:34Z","updated_at":"2016-09-23T02:58:30Z","closed_at":null,"body":"Given this simple geolocation query, when I include the \"near\" query I'm getting this error:\r\n```\r\n/node_modules/mongodb/lib/utils.js:98\r\n    process.nextTick(function() { throw err; });\r\n                                  ^\r\n\r\nError: Callback was already called.\r\n    at /node_modules/async/dist/async.js:844:36\r\n    at /node_modules/async/dist/async.js:3676:17\r\n    at /node_modules/async/dist/async.js:339:31\r\n    at /node_modules/strong-remoting/lib/remote-objects.js:694:7\r\n    at execStack (/node_modules/strong-remoting/lib/remote-objects.js:490:9)\r\n    at RemoteObjects.execHooks (/node_modules/strong-remoting/lib/remote-objects.js:497:10)\r\n    at interceptInvocationErrors (/node_modules/strong-remoting/lib/remote-objects.js:693:10)\r\n    at /node_modules/loopback-phase/node_modules/async/lib/async.js:148:21\r\n    at /node_modules/loopback-phase/node_modules/async/lib/async.js:148:21\r\n    at /node_modules/loopback-phase/node_modules/async/lib/async.js:148:21\r\n```\r\n\r\nCan't find the root cause of this.\r\n\r\nThis code works:\r\n\r\n\r\n\r\n```\r\nuser.find({}, function(err, users) {\r\n        if (err) {\r\n          return cb(err);\r\n        }\r\n        return cb(null, users);\r\n    });\r\n  };\r\n```\r\nThis one below throws the error. I've placed a breakpoint in the callback, and it does get called twice internally. Couldn't trace it too far so not sure what's firing this.\r\n\r\n```\r\nuser.find({\r\n      where: {\r\n        location: {near: here, maxDistance: distance, unit: 'meters'}\r\n      }\r\n    }, function(err, users) {\r\n        if (err) {\r\n          return cb(err);\r\n        }\r\n        return cb(null, users);\r\n    });\r\n  };\r\n```"},"comment":{"url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/issues/comments/249089897","html_url":"https://github.com/strongloop/loopback-connector-mongodb/issues/285#issuecomment-249089897","issue_url":"https://api.github.com/repos/strongloop/loopback-connector-mongodb/issues/285","id":249089897,"user":{"login":"superkhau","id":1617364,"avatar_url":"https://avatars.githubusercontent.com/u/1617364?v=3","gravatar_id":"","url":"https://api.github.com/users/superkhau","html_url":"https://github.com/superkhau","followers_url":"https://api.github.com/users/superkhau/followers","following_url":"https://api.github.com/users/superkhau/following{/other_user}","gists_url":"https://api.github.com/users/superkhau/gists{/gist_id}","starred_url":"https://api.github.com/users/superkhau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superkhau/subscriptions","organizations_url":"https://api.github.com/users/superkhau/orgs","repos_url":"https://api.github.com/users/superkhau/repos","events_url":"https://api.github.com/users/superkhau/events{/privacy}","received_events_url":"https://api.github.com/users/superkhau/received_events","type":"User","site_admin":false},"created_at":"2016-09-23T02:58:29Z","updated_at":"2016-09-23T02:58:29Z","body":"@Amir-61 has been able to reproduce the error and is working on a fix. It is a regression introduced at https://github.com/strongloop/loopback-datasource-juggler/pull/1061.\r\n\r\nIf @jainisenough @rptally @bachirelkhoury want to take a crack at it, ping me and we can get the fix landed sooner."}}
{"actor":{"display_login":"superkhau"}}