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

Utilize nameOnly : true for database_names method

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.5
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible

      Right now the database_names command returns a list of the databases on a server (https://github.com/mongodb/mongo-python-driver/blob/master/pymongo/mongo_client.py). In Mongo 3.2.13 they added the capability to return only the database names, without the stats. This allows it to not need locks in order to return the data. This came up because the data gatherer for DataDog does a database_names call. https://github.com/DataDog/integrations-core/blob/master/mongo/check.py (search cli.database_names).

      Since the command itself just returns the names, then passing nameOnly : true in the options would reduce the lock profile required for the query to complete, resulting in an easy performance win for mongo versions supporting the argument. For versions which do not, it still completes, just does the current behavior.

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            owenallenaz Owen Allen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: