Manipulators that can edit SON objects as they enter and exit a database.
New manipulators should be defined as subclasses of SONManipulator and can be installed on a database by calling pymongo.database.Database.add_son_manipulator.
Transparently reference and de-reference already saved embedded objects.
This manipulator should probably only be used when the NamespaceInjector is also being used, otherwise it doesn’t make too much sense - documents can only be auto-referenced if they have an _ns field.
NOTE: this will behave poorly if you have a circular reference.
TODO: this only works for documents that are in the same database. To fix this we’ll need to add a DatabaseInjector that adds _db and then make use of the optional database support for DBRefs.
A son manipulator that adds the _ns field.
A son manipulator that adds the _id field if it is missing.
A son manipulator that moves _id to the first position.
A base son manipulator.
This manipulator just saves and restores objects without changing them.
Manipulate an incoming SON object.
Parameters: |
|
---|
Manipulate an outgoing SON object.
Parameters: |
|
---|
Will this SON manipulator make a copy of the incoming document?
Derived classes that do need to make a copy should override this method, returning True instead of False. All non-copying manipulators will be applied first (so that the user’s document will be updated appropriately), followed by copying manipulators.