driver_info

Advanced options for MongoDB drivers implemented on top of PyMongo.

See also

This module is compatible with both the synchronous and asynchronous PyMongo APIs.

class pymongo.driver_info.DriverInfo(name=None, version=None, platform=None)

Info about a driver wrapping PyMongo.

The MongoDB server logs PyMongo’s name, version, and platform whenever PyMongo establishes a connection. A driver implemented on top of PyMongo can add its own info to this log message. Initialize with three strings like ‘MyDriver’, ‘1.2.3’, ‘some platform info’. Any of these strings may be None. A None or empty name or version appends an empty metadata segment, keeping the driver.name and driver.version segment counts aligned. A None or empty platform omits the platform.

The | character is the reserved delimiter used to join appended metadata, so it must not appear in any of the fields. A ValueError is raised if it does.

Parameters:
  • name (str)

  • version (Optional[str])

  • platform (Optional[str])

Return type:

DriverInfo