code: def execute_command(self, generator, write_concern, session):
          
          # nModified is only reported for write commands, not legacy ops.
          full_result = {
              "writeErrors": [],
              "writeConcernErrors": [],
              "nInserted": 0,
              "nUpserted": 0,
              "nMatched": 0,
              "nModified": 0,
              "nRemoved": 0,
              "upserted": [],
          }
          op_id = _randint()
  
          def retryable_bulk(session, sock_info, retryable):
              self._execute_command(
                  generator, write_concern, session, sock_info, op_id,
                  retryable, full_result)
  
          client = self.collection.database.client
          with client._tmp_session(session) as s:
              client._retry_with_session(
                  self.is_retryable, retryable_bulk, s, self)
  
          if full_result["writeErrors"] or full_result["writeConcernErrors"]:
              _raise_bulk_write_error(full_result)
          return full_result
docs: Execute using write commands.