Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-674

Wait that all $cmd are done before close MongoClient

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.1.8
    • Affects Version/s: 2.0.39
    • Component/s: None
    • Labels:
    • Environment:
      Nodejs 0.10.25
      Linux Ubuntu
      MongoDB server in localhost

      I share the mongodb connection thought all http requests that my webserver (nodejs) receives.

      When i want to stop the webserver, before all, I refuse new connections, close mongodb connection, and the process exits graceful (all sockets are closed and the event loop is empty).

      But, if the `MongoClient.close` method is called while a http request writes/reads from datas from mongo, an exception is thrown.

      As attachment, there's an example of this problem.

      How can I wait for all connection closing?

        1. prova.js
          0.8 kB
          Tommaso Allevi

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            tomallevi@gmail.com Tommaso Allevi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: