def add_update(self, selector, update, multi=False, upsert=False,
                   collation=None, array_filters=None):
        """Create an update document and add it to the list of ops.
        """
        validate_ok_for_update(update)
        cmd = SON([('q', selector), ('u', update),
                   ('multi', multi), ('upsert', upsert)])
        collation = validate_collation_or_none(collation)
        if collation is not None:
            self.uses_collation = True
            cmd['collation'] = collation
        if array_filters is not None:
            self.uses_array_filters = True
            cmd['arrayFilters'] = array_filters
        if multi:
            # A bulk_write containing an update_many is not retryable.
            self.is_retryable = False
        self.ops.append((_UPDATE, cmd))
def add_update ( self , selector , update , multi = False , upsert = False , collation = None , array_filters = None ) : validate_ok_for_update ( update ) cmd = SON ( [ ( 'q' , selector ) , ( 'u' , update ) , ( 'multi' , multi ) , ( 'upsert' , upsert ) ] ) collation = validate_collation_or_none ( collation ) if collation is not None : self . uses_collation = True cmd [ 'collation' ] = collation if array_filters is not None : self . uses_array_filters = True cmd [ 'arrayFilters' ] = array_filters if multi : self . is_retryable = False self . ops . append ( ( _UPDATE , cmd ) )
Create an update document and add it to the list of ops.