nanomongo.util — RecordingDict¶
RecordingDict¶
-
class
nanomongo.util.RecordingDict(*args, **kwargs)[source]¶ A dictionary subclass modifying
__setitem__()and__delitem__()methods to record changes in its__nanodiff__attribute-
check_can_update(modifier, field_name)[source]¶ Check if given modifier field_name combination can be added. MongoDB does not allow field duplication with update modifiers. This is to be used with methods addToSet …
-
clean_other_modifiers(current_mod, field_name)[source]¶ Given current_mod, removes other field_name modifiers, eg. when called with $set, removes $unset and $addToSet etc. on field_name
-
get_sub_diff()[source]¶ get __nanodiff__ from embedded documents. Find fields of
RecordingDicttype, iterate over their diff and build dotted keys for top level diff
-
-
class
nanomongo.util.NanomongoSONManipulator(as_class, transforms=None)[source]¶ A pymongo SON Manipulator used on data that comes from the database to transform data to the document class we want because as_class argument to pymongo find methods is called in a way that screws us.
- Recursively applied, we don’t want that
- __init__ is not properly used but rather __setitem__, fails us
JIRA: PYTHON-175 PYTHON-215