{"action":"created","issue":{"url":"https://api.github.com/repos/mafintosh/mongojs/issues/224","labels_url":"https://api.github.com/repos/mafintosh/mongojs/issues/224/labels{/name}","comments_url":"https://api.github.com/repos/mafintosh/mongojs/issues/224/comments","events_url":"https://api.github.com/repos/mafintosh/mongojs/issues/224/events","html_url":"https://github.com/mafintosh/mongojs/issues/224","id":96673242,"number":224,"title":"db.close() issue","user":{"login":"ivanrkv","id":1719635,"avatar_url":"https://avatars.githubusercontent.com/u/1719635?v=3","gravatar_id":"","url":"https://api.github.com/users/ivanrkv","html_url":"https://github.com/ivanrkv","followers_url":"https://api.github.com/users/ivanrkv/followers","following_url":"https://api.github.com/users/ivanrkv/following{/other_user}","gists_url":"https://api.github.com/users/ivanrkv/gists{/gist_id}","starred_url":"https://api.github.com/users/ivanrkv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivanrkv/subscriptions","organizations_url":"https://api.github.com/users/ivanrkv/orgs","repos_url":"https://api.github.com/users/ivanrkv/repos","events_url":"https://api.github.com/users/ivanrkv/events{/privacy}","received_events_url":"https://api.github.com/users/ivanrkv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-22T21:49:57Z","updated_at":"2015-07-25T14:38:26Z","closed_at":null,"body":"Hey,\r\nFirst of, awesome module.\r\nSecond of, I'm just starting to use mongodb, I noticed that my app after running for a while, throws a \"EMFILE, too many open files\", which I figured has something to do with me not closing all the database connections. So I tried doing just that, with db.close() in my functions, but that's throwing a \"Object [object Object] has no method 'destroy'\". Do you think that's something in mongojs or should I hunt for other problems in my code?\r\n\r\nThank you for your attention. "},"comment":{"url":"https://api.github.com/repos/mafintosh/mongojs/issues/comments/124851563","html_url":"https://github.com/mafintosh/mongojs/issues/224#issuecomment-124851563","issue_url":"https://api.github.com/repos/mafintosh/mongojs/issues/224","id":124851563,"user":{"login":"saintedlama","id":123820,"avatar_url":"https://avatars.githubusercontent.com/u/123820?v=3","gravatar_id":"","url":"https://api.github.com/users/saintedlama","html_url":"https://github.com/saintedlama","followers_url":"https://api.github.com/users/saintedlama/followers","following_url":"https://api.github.com/users/saintedlama/following{/other_user}","gists_url":"https://api.github.com/users/saintedlama/gists{/gist_id}","starred_url":"https://api.github.com/users/saintedlama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saintedlama/subscriptions","organizations_url":"https://api.github.com/users/saintedlama/orgs","repos_url":"https://api.github.com/users/saintedlama/repos","events_url":"https://api.github.com/users/saintedlama/events{/privacy}","received_events_url":"https://api.github.com/users/saintedlama/received_events","type":"User","site_admin":false},"created_at":"2015-07-25T14:38:26Z","updated_at":"2015-07-25T14:38:26Z","body":"Your code seems a bit odd because you change a db variable that is defined outside of the function scope. May it be that this error arises from this issue? Could you `console.log(db)` before closing db?"}}