{"action":"created","issue":{"url":"https://api.github.com/repos/mafintosh/mongojs/issues/168","labels_url":"https://api.github.com/repos/mafintosh/mongojs/issues/168/labels{/name}","comments_url":"https://api.github.com/repos/mafintosh/mongojs/issues/168/comments","events_url":"https://api.github.com/repos/mafintosh/mongojs/issues/168/events","html_url":"https://github.com/mafintosh/mongojs/issues/168","id":54450655,"number":168,"title":"Processing from standalone process","user":{"login":"KrzysztofMadejski","id":849975,"avatar_url":"https://avatars.githubusercontent.com/u/849975?v=3","gravatar_id":"","url":"https://api.github.com/users/KrzysztofMadejski","html_url":"https://github.com/KrzysztofMadejski","followers_url":"https://api.github.com/users/KrzysztofMadejski/followers","following_url":"https://api.github.com/users/KrzysztofMadejski/following{/other_user}","gists_url":"https://api.github.com/users/KrzysztofMadejski/gists{/gist_id}","starred_url":"https://api.github.com/users/KrzysztofMadejski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrzysztofMadejski/subscriptions","organizations_url":"https://api.github.com/users/KrzysztofMadejski/orgs","repos_url":"https://api.github.com/users/KrzysztofMadejski/repos","events_url":"https://api.github.com/users/KrzysztofMadejski/events{/privacy}","received_events_url":"https://api.github.com/users/KrzysztofMadejski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-15T13:47:22Z","updated_at":"2015-01-15T16:15:44Z","closed_at":null,"body":"Hi,\r\n\r\nI'm wondering how to properly initialize connection and process data in standalone process. I'm starting to communicate with mongo after receiving 'ready' event, so I'm sure everything is properly initialized. \r\n\r\nThe problem is my node process exits before I'm able to query anything. Is there any `db.wait()` I'm missing below? Shoudn't node wait till all connections are closed?\r\n\r\n```coffee\r\ndb = mongojs(config.mongo_connection, ['user'])\r\n\r\ndb.on 'ready', () ->\r\n    # may not get executed because process finishes\r\n    console.log('database connected');\r\n    db.user.findOne()\r\n```"},"comment":{"url":"https://api.github.com/repos/mafintosh/mongojs/issues/comments/70110925","html_url":"https://github.com/mafintosh/mongojs/issues/168#issuecomment-70110925","issue_url":"https://api.github.com/repos/mafintosh/mongojs/issues/168","id":70110925,"user":{"login":"sorribas","id":1163358,"avatar_url":"https://avatars.githubusercontent.com/u/1163358?v=3","gravatar_id":"","url":"https://api.github.com/users/sorribas","html_url":"https://github.com/sorribas","followers_url":"https://api.github.com/users/sorribas/followers","following_url":"https://api.github.com/users/sorribas/following{/other_user}","gists_url":"https://api.github.com/users/sorribas/gists{/gist_id}","starred_url":"https://api.github.com/users/sorribas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorribas/subscriptions","organizations_url":"https://api.github.com/users/sorribas/orgs","repos_url":"https://api.github.com/users/sorribas/repos","events_url":"https://api.github.com/users/sorribas/events{/privacy}","received_events_url":"https://api.github.com/users/sorribas/received_events","type":"User","site_admin":false},"created_at":"2015-01-15T16:15:44Z","updated_at":"2015-01-15T16:15:44Z","body":"It is not synchronous, but the database is lazy evaluated, which means that it will try to connect at the time the first operation is attempted."}}