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

db.getMongo() gives localhost when connected to Atlas and Atlas Data Lakes

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.7.7
    • Affects Version/s: 0.6.1
    • Component/s: Shell API
    • None
    • Iteration Uglifruit
    • Not Needed

      Problem Description

      When connected to an Atlas cluster or Atlas Data Lake, db.getMongo() shows a connection to localhost, not the cluster/data lake.

      Steps to Reproduce

      $ mongosh "mongodb://<REDACTED>@loadtest-0wuse.a.query.mongodb-stage.net/?ssl=true&authSource=admin"
      Connecting to:    mongodb://<credentials>@loadtest-0wuse.a.query.mongodb-stage.net/?ssl=true&authSource=admin
      ...
      > db.getMongo()
      mongodb://localhost/
      

      Expected Results

      I expected db.getMongo() to return the hostname of the data lake.

      Actual Results

      It returned localhost.

      Additional Notes

      The response format differs from the server shell.

      Data lake (standalone):

      > db.getMongo()
      connection to loadtest-0wuse.a.query.mongodb-stage.net:27017
      

      Cluster (replica set):

      MongoDB Enterprise mongohouse-dev-shard-0:PRIMARY> db.getMongo()
      connection to mongohouse-dev-shard-0/mongohouse-dev-shard-00-00.ki9ie.mongodb.net:27017,mongohouse-dev-shard-00-01.ki9ie.mongodb.net:27017,mongohouse-dev-shard-00-02.ki9ie.mongodb.net:27017
      

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            david.golden@mongodb.com David Golden
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: