lib/mongodb/mongodb/lib/bulk/common.js
function handleMongoWriteConcernError(batch, bulkResult, ordered, err, callback) {
  mergeBatchResults(ordered, batch, bulkResult, null, err.result);

  const wrappedWriteConcernError = new WriteConcernError({
    errmsg: err.result.writeConcernError.errmsg,
    code: err.result.writeConcernError.result
  });
  return handleCallback(
    callback,
    new BulkWriteError(toError(wrappedWriteConcernError), new BulkWriteResult(bulkResult)),
    null
  );
}
function handleMongoWriteConcernError(batch, bulkResult, ordered, err, callback) {
  mergeBatchResults(ordered, batch, bulkResult, null, err.result);

  const wrappedWriteConcernError = new WriteConcernError({
    errmsg: err.result.writeConcernError.errmsg,
    code: err.result.writeConcernError.result
  });
  return handleCallback(
    callback,
    new BulkWriteError(toError(wrappedWriteConcernError), new BulkWriteResult(bulkResult)),
    null
  );
}
function handleMongoWriteConcernError ( batch , bulkResult , ordered , err , callback ) { mergeBatchResults ( ordered , batch , bulkResult , null , err . result ) ; const wrappedWriteConcernError = new WriteConcernError ( { errmsg : err . result . writeConcernError . errmsg , code : err . result . writeConcernError . result } ) ; return handleCallback ( callback , new BulkWriteError ( toError ( wrappedWriteConcernError ) , new BulkWriteResult ( bulkResult ) ) , null ) ; }
handles write concern error

@param {object} batch
@param {object} bulkResult
@param {boolean} ordered
@param {WriteConcernError} err
@param {function} callback
handles write concern error