Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-814

connect() method does not re-use options from command line

    • Iteration Düsseldorf
    • Needed
    • Hide

      The legacy shell inherited the --tls option when creating new connections programmatically using connect() or [new] Mongo().

      As far as we could tell, that was the only inherited option.

      For consistency, mongosh does not do this anymore, and instead the tls flag needs to be set explicitly in the connection string passed to connect() or [new] Mongo in order to enable TLS.

      This should be documented.

      Show
      The legacy shell inherited the --tls option when creating new connections programmatically using connect() or [new] Mongo() . As far as we could tell, that was the only inherited option. For consistency, mongosh does not do this anymore, and instead the tls flag needs to be set explicitly in the connection string passed to connect() or [new] Mongo in order to enable TLS. This should be documented.

      Steps to repro:

      • Connect to a TLS-using mongod with --tls (not the connection string flag)
      • Use connect(db.getMongo()._uri)
      • See it fail because connect did not re-use the --tls flag from the command line

      Generally speaking, I think we need to check how command line arguments affect connect() and [new] Mongo() and make sure that we emulate the legacy shell’s behavior (connect uses the Mongo constructor under the hood, i.e. they have the same behavior here).

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            anna.henningsen@mongodb.com Anna Henningsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: