def __enter__(self):
        for field in self.deref_fields:
            self.cls._fields[field]._auto_dereference = False
        return self.cls
change the objects default and _auto_dereference values
dataset/ETHPy150Open MongoEngine/mongoengine/mongoengine/context_managers.py/no_dereference.__enter__