MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / update_one

Method update_one

mongoengine/queryset/base.py:637–669  ·  view source on GitHub ↗

Perform an atomic update on the fields of the first document matched by the query. :param upsert: insert if document doesn't exist (default ``False``) :param write_concern: Extra keyword arguments are passed down which will be used as options for the resultant

(
        self,
        upsert=False,
        write_concern=None,
        full_result=False,
        array_filters=None,
        **update,
    )

Source from the content-addressed store, hash-verified

635 return document
636
637 def update_one(
638 self,
639 upsert=False,
640 write_concern=None,
641 full_result=False,
642 array_filters=None,
643 **update,
644 ):
645 """Perform an atomic update on the fields of the first document
646 matched by the query.
647
648 :param upsert: insert if document doesn't exist (default ``False``)
649 :param write_concern: Extra keyword arguments are passed down which
650 will be used as options for the resultant
651 ``getLastError`` command. For example,
652 ``save(..., write_concern={w: 2, fsync: True}, ...)`` will
653 wait until at least two servers have recorded the write and
654 will force an fsync on the primary server.
655 :param full_result: Return the associated ``pymongo.UpdateResult`` rather than just the number
656 updated items
657 :param array_filters: A list of filters specifying which array elements an update should apply.
658 :param update: Django-style update keyword arguments
659 full_result
660 :returns the number of updated documents (unless ``full_result`` is True)
661 """
662 return self.update(
663 upsert=upsert,
664 multi=False,
665 write_concern=write_concern,
666 full_result=full_result,
667 array_filters=array_filters,
668 **update,
669 )
670
671 def modify(
672 self,

Calls 1

updateMethod · 0.95