mongoframes/frames.py
def update(self, *fields):
        """
        Update this document. Optionally a specific list of fields to update can
        be specified.
        """
        from mongoframes.queries import to_refs

        assert '_id' in self._document, "Can't update documents without `_id`"

        # Send update signal
        signal('update').send(self.__class__, frames=[self])

        # Check for selective updates
        if len(fields) > 0:
            document = {}
            for field in fields:
                document[field] = self._path_to_value(field, self._document)
        else:
            document = self._document

        # Prepare the document to be updated
        document = to_refs(document)
        document.pop('_id', None)

        # Update the document
        self.get_collection().update_one({'_id': self._id}, {'$set': document})

        # Send updated signal
        signal('updated').send(self.__class__, frames=[self])

        Update this document. Optionally a specific list of fields to update can
        be specified.
        
Update this document. Optionally a specific list of fields to update can
be specified.
Update this document . Optionally a specific list of fields to update can be specified .
def update(self, *fields):
        from mongoframes.queries import to_refs
        assert '_id' in self._document, "Can't update documents without `_id`"
        signal('update').send(self.__class__, frames=[self])
        if len(fields) > 0:
            document = {}
            for field in fields:
                document[field] = self._path_to_value(field, self._document)
        else:
            document = self._document
        document = to_refs(document)
        document.pop('_id', None)
        self.get_collection().update_one({'_id': self._id}, {'$set': document})
        signal('updated').send(self.__class__, frames=[self])
def update ( self , * fields ) : from mongoframes . queries import to_refs assert '_id' in self . _document , "Can't update documents without `_id`" signal ( 'update' ) . send ( self . __class__ , frames = [ self ] ) if len ( fields ) > 0 : document = { } for field in fields : document [ field ] = self . _path_to_value ( field , self . _document ) else : document = self . _document document = to_refs ( document ) document . pop ( '_id' , None ) self . get_collection ( ) . update_one ( { '_id' : self . _id } , { '$set' : document } ) signal ( 'updated' ) . send ( self . __class__ , frames = [ self ] )
Update this document.
Update this document .
"""
        Update this document. Optionally a specific list of fields to update can
        be specified.
        """ # Send update signal # Check for selective updates # Prepare the document to be updated # Update the document # Send updated signal
self