def reload(self):
        """
        allow to refresh the document, so after using update(), it could reload
        its value from the database.

        Be carreful : reload() will erase all unsaved values.

        If no _id is set in the document, a KeyError is raised.

        """

        old_doc = self.mongokat_collection.find_one({"_id": self['_id']}, read_use="primary")

        if not old_doc:
            raise OperationFailure('Can not reload an unsaved document.'
                                   ' %s is not found in the database. Maybe _id was a string and not ObjectId?' % self['_id'])
        else:
            for k in list(self.keys()):
                del self[k]
            self.update(dotdict(old_doc))

        self._initialized_with_doc = False
def reload ( self ) : old_doc = self . mongokat_collection . find_one ( { "_id" : self [ '_id' ] } , read_use = "primary" ) if not old_doc : raise OperationFailure ( 'Can not reload an unsaved document.' ' %s is not found in the database. Maybe _id was a string and not ObjectId?' % self [ '_id' ] ) else : for k in list ( self . keys ( ) ) : del self [ k ] self . update ( dotdict ( old_doc ) ) self . _initialized_with_doc = False
allow to refresh the document, so after using update(), it could reload
        its value from the database.

        Be carreful : reload() will erase all unsaved values.

        If no _id is set in the document, a KeyError is raised.