def update(self, *fields):
from mongoframes.queries import to_refs<EOL>assert '<STR_LIT>' in self._document, "<STR_LIT>"<EOL>signal('<STR_LIT>').send(self.__class__, frames=[self])<EOL>if len(fields) > <NUM_LIT:0>:<EOL><INDENT>document = {}<EOL>for field in fields:<EOL><INDENT>document[field] = self._path_to_value(field, self._document)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>document = self._document<EOL><DEDENT>document = to_refs(document)<EOL>document.pop('<STR_LIT>', None)<EOL>self.get_collection().update_one({'<STR_LIT>': self._id}, {'<STR_LIT>': document})<EOL>signal('<STR_LIT>').send(self.__class__, frames=[self])<EOL>
Update this document. Optionally a specific list of fields to update can
be specified.