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

Update documentation to prefer ping command over ismaster

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.12, 4.0
    • None
    • None

    Description

      We need to update this example from the MongoClient docs:

              from pymongo.errors import ConnectionFailure
              client = MongoClient()
              try:
                  # The ismaster command is cheap and does not require auth.
                  client.admin.command('ismaster')
              except ConnectionFailure:
                  print("Server not available")
      

      The new example should use ping:

              from pymongo.errors import ConnectionFailure
              client = MongoClient()
              try:
                  # The ping command is cheap and does not require auth.
                  client.admin.command('ping')
              except ConnectionFailure:
                  print("Server not available")
      

      See https://www.mongodb.com/community/forums/t/how-to-use-the-new-hello-interface-for-availability/116748/1

      Attachments

        Activity

          People

            bernie@mongodb.com Bernie Hackett
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: