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

Make operations call MongoClient.connect automatically

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0
    • Affects Version/s: None
    • Component/s: None
    • Needed

      How are you using Mongo? What version of the server and driver are you using?

      Using the driver to perform operations against a server.

      What is the feature/improvement you would like?

      I want the first operation run on a client to perform connect automatically if it hasn't been done already. Internally we should use the flag that disables the initial ping since authentication failures (the sole reason for the ping) will be surfaced by the operation that is being attempted.

      What use case would this feature/improvement enable?

      You could construct and immediately use a mongo client without calling connect.

      Acceptance Criteria

      • Make MongoClient accessible inside execute operation to call connect.
      • Review tests and update any that explicitly call MongoClient connect.
        • File a separate PR for this.
      • Add an explicit test for MongoClient connect behavior
      • Add a regression test to make sure we can successfully execute an operation after calling connect first explicitly.
      • Add a test to make sure that we can call an operation without calling connect first explicitly.
        • If an error occurs in connect, ensure the error is handled and passed to the user. Ex. if we have a server selection timeout when you run a find.
      • Mark DOCS needed and remove explicit connect from the operations examples.

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: