(self, sock_info, generator)
Execute all operations, returning no results (w=0).
Execute all operations, returning no results (w=0).
Execute all operations returning no results ( w = 0 ) .
def execute_no_results(self, sock_info, generator):
        """Execute all operations, returning no results (w=0).
        """
        # Cannot have both unacknowledged write and bypass document validation.
        if self.bypass_doc_val and sock_info.max_wire_version >= 4:
            raise OperationFailure("Cannot set bypass_document_validation with"
                                   " unacknowledged write concern")
        coll = self.collection
        # If ordered is True we have to send GLE or use write
        # commands so we can abort on the first error.
        write_concern = WriteConcern(w=int(self.ordered))
        op_id = _randint()

        for run in generator:
            try:
                if run.op_type == _INSERT:
                    coll._insert(
                        sock_info,
                        run.ops,
                        self.ordered,
                        write_concern=write_concern,
                        op_id=op_id,
                        bypass_doc_val=self.bypass_doc_val)
                elif run.op_type == _UPDATE:
                    for operation in run.ops:
                        doc = operation['u']
                        check_keys = True
                        if doc and next(iter(doc)).startswith('$'):
                            check_keys = False
                        coll._update(
                            sock_info,
                            operation['q'],
                            doc,
                            operation['upsert'],
                            check_keys,
                            operation['multi'],
                            write_concern=write_concern,
                            op_id=op_id,
                            ordered=self.ordered,
                            bypass_doc_val=self.bypass_doc_val)
                else:
                    for operation in run.ops:
                        coll._delete(sock_info,
                                     operation['q'],
                                     not operation['limit'],
                                     write_concern,
                                     op_id,
                                     self.ordered)
            except OperationFailure:
                if self.ordered:
                    break
def execute_no_results ( self , sock_info , generator ) : # Cannot have both unacknowledged write and bypass document validation. if self . bypass_doc_val and sock_info . max_wire_version >= 4 : raise OperationFailure ( "Cannot set bypass_document_validation with" " unacknowledged write concern" ) coll = self . collection # If ordered is True we have to send GLE or use write # commands so we can abort on the first error. write_concern = WriteConcern ( w = int ( self . ordered ) ) op_id = _randint ( ) for run in generator : try : if run . op_type == _INSERT : coll . _insert ( sock_info , run . ops , self . ordered , write_concern = write_concern , op_id = op_id , bypass_doc_val = self . bypass_doc_val ) elif run . op_type == _UPDATE : for operation in run . ops : doc = operation [ 'u' ] check_keys = True if doc and next ( iter ( doc ) ) . startswith ( '$' ) : check_keys = False coll . _update ( sock_info , operation [ 'q' ] , doc , operation [ 'upsert' ] , check_keys , operation [ 'multi' ] , write_concern = write_concern , op_id = op_id , ordered = self . ordered , bypass_doc_val = self . bypass_doc_val ) else : for operation in run . ops : coll . _delete ( sock_info , operation [ 'q' ] , not operation [ 'limit' ] , write_concern , op_id , self . ordered ) except OperationFailure : if self . ordered : break