codec_options – Tools for specifying BSON codec options

Tools for specifying BSON codec options.

class bson.codec_options.CodecOptions

Encapsulates BSON options used in CRUD operations.

Parameters:
  • document_class: BSON documents returned in queries will be decoded to an instance of this class. Must be a subclass of MutableMapping. Defaults to dict.
  • tz_aware: If True, BSON datetimes will be decoded to timezone aware instances of datetime. Otherwise they will be naive. Defaults to False.
  • uuid_representation: The BSON representation to use when encoding and decoding instances of UUID. Defaults to PYTHON_LEGACY.