There is bug with SONManipulator optimization here: https://github.com/mongodb/mongo-python-driver/blob/master/pymongo/database.py#L95
Due to this bug:
- we cannot create manipulator that isn't inherited from SONManipulator class. That's not so good.
- we cannot create two (or more) level manipulators inheritance hierarhy. For example this wouldn't work correct:
from pymongo.son_manipulator import SONManipulator class ParentManipulator(SONManipulator): def transform_incoming(self, son, collection): son['collection_name'] = collection.name return son def transform_outgoing(self, son, collection): if 'collection_name' in son: del son['collection_name'] return son class ChildManipulator(ParentManipulator): """ It should work like ParentManipulator, but it wouldn't work at call :( """ pass