codec_options – Tools for specifying BSON codec options

Tools for specifying BSON codec options.

class bson.codec_options.CodecOptions(document_class=<class 'dict'>, tz_aware=False, uuid_representation=3, unicode_decode_error_handler='strict', tzinfo=None)

Create new instance of CodecOptions(document_class, tz_aware, uuid_representation, unicode_decode_error_handler, tzinfo)

with_options(**kwargs)

Make a copy of this CodecOptions, overriding some options:

>>> from bson.codec_options import DEFAULT_CODEC_OPTIONS
>>> DEFAULT_CODEC_OPTIONS.tz_aware
False
>>> options = DEFAULT_CODEC_OPTIONS.with_options(tz_aware=True)
>>> options.tz_aware
True

New in version 3.5.