node-mongolian
node-mongolian copied to clipboard
Server connection won't close
It seems to be an issue with MongolianServer._connection not having a cached value until one of the connections callbacks is called, it fixes the issue of you call the callback right away.
it doesn't break any of the existing tests, but I couldn't think of a clever way to test this without digging into internals.
https://github.com/marcello3d/node-mongolian/pull/67
I don't get it, how can i close the connection? my script won't finish!
force your script to close the server connection in a callback that actually uses one of the collections, say, listing the available indices for the collection.
getCollection (err, collection) ->
collection.indexes (err, indexes) ->
server.close()
db.server.close() or just server.close() if your have the server instance