Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1000

Incorect value for HOST & PORT properties of MongoClient object

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.0.3
    • Component/s: None
    • Labels:
    • Environment:

      The following code illustrates the problem. Essentially print str(MongoClient) returns the expected output but the HOST and PORT properties do not.

      from pymongo import MongoClient
      
      c = MongoClient("localhost", 27017)
      print c
      print c.HOST
      print str(c.PORT)
      c.close()
      
      c = MongoClient("mongodb://localhost:30001/test")
      print c
      print c.HOST
      print str(c.PORT)
      
      c = MongoClient("localhost.localdomain", 30001)
      print c
      print c.HOST
      print str(c.PORT)
      
      c = MongoClient(host="localhost", port=30001)
      print c
      print c.HOST
      print str(c.PORT)
      

      Output is as follows...

      <pre>
      MongoClient('localhost', 27017)
      localhost
      27017
      MongoClient('localhost', 30001)
      localhost
      27017
      MongoClient('localhost.localdomain', 30001)
      localhost
      27017
      MongoClient('localhost', 30001)
      localhost
      27017
      </pre>

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            rhys.james.campbell@googlemail.com Rhys Campbell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: