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

db.getMongo() command shows wrong current database connection.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.0.0
    • Affects Version/s: 0.1.0
    • Component/s: Shell API
    • None
    • Environment:
      Windows 10, PowerShell 7
    • Not Needed

      Problem Statement/Rationale

      After connecting to a remote deployment from a Windows 10 client, mongosh does not show the current database connection.

      Steps to Reproduce

      1. Connect to remote database from local client (Windows 10): mongosh "mongodb://mongodb0.example.com:28015,mongodb1.example.com:28015,mongodb2.example.com:28015/?replicaSet=ReplA" --username alice --authenticationDatabase admin
      2. Current sessionID: 1c3fcd0b24f9508dec399a51
        Connecting to: mongodb0.example.com:28015,mongodb1.example.com:28015,mongodb2.example.com:28015/?replicaSet=ReplA
        Using MongoDB: 4.4.0-1
        Using Mongosh Beta: 0.1.0

      For more information about mongosh, please see our docs: https://docs.mongodb.com/mongodb-shell/

      1. Run db.getMongo()

      Expected Results

      mongodb0.example.com:28015,mongodb1.example.com:28015,mongodb2.example.com:28015/?replicaSet=ReplA

      Actual Results

      It shows localhost instead of the current database connection

      > db.getMongo()
      mongodb://localhost/

      Additional Notes

      Any additional information that may be useful to include.

            Assignee:
            Unassigned Unassigned
            Reporter:
            rodrigo_n_silva@dell.com Rodrigo Silva
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: