node-mongolian icon indicating copy to clipboard operation
node-mongolian copied to clipboard

Server connection won't close

Open xcoderzach opened this issue 13 years ago • 4 comments

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.

xcoderzach avatar Dec 18 '11 00:12 xcoderzach

https://github.com/marcello3d/node-mongolian/pull/67

jaekwon avatar Dec 20 '11 08:12 jaekwon

I don't get it, how can i close the connection? my script won't finish!

demian85 avatar Jan 23 '12 18:01 demian85

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()

jaekwon avatar Jan 23 '12 20:01 jaekwon

db.server.close() or just server.close() if your have the server instance

defunctzombie avatar Jun 26 '12 21:06 defunctzombie