Incorect value for HOST & PORT properties of MongoClient object

XMLWordPrintableJSON

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

      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 Hackett
            Reporter:
            Rhys Campbell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: