Module motor_odm.encoders

BSON encoders for common python types.

This module contains a collection of bson.codec_options.TypeEncoder subclasses for common python types such as sets. Note that these encoders are provided as a convenience but are not used automatically. If you want to use sets in your documents you have to provide the appropriate codec_options to the MongoDB client, database, collection or function.

class motor_odm.encoders.SetEncoder

Bases: bson.codec_options.TypeEncoder

BSON support for python set.

This encoder encodes a set in form of a list. The list is not converted back into a set automatically but if you are using the Document class this is done upon initialization of your model.

python_type

alias of builtins.set

transform_python

alias of builtins.list

class motor_odm.encoders.FrozensetEncoder

Bases: bson.codec_options.TypeEncoder

BSON support for python frozenset.

This encoder encodes a frozenset in form of a list. The list is not converted back into a set automatically but if you are using the Document class this is done upon initialization of your model.

python_type

alias of builtins.frozenset

transform_python

alias of builtins.list