def validate_read_preference!(command)
      return unless in_transaction? && non_primary_read_preference_mode?(command)

      raise Mongo::Error::InvalidTransactionOperation.new(
        Mongo::Error::InvalidTransactionOperation::INVALID_READ_PREFERENCE)
    end
def validate_read_preference!(command)
      return unless in_transaction? && non_primary_read_preference_mode?(command)

      raise Mongo::Error::InvalidTransactionOperation.new(
        Mongo::Error::InvalidTransactionOperation::INVALID_READ_PREFERENCE)
    end
Ensure that the read preference of a command primary.

 @example
   session.validate_read_preference!(command)

 @raise [ Mongo::Error::InvalidTransactionOperation ] If the read preference of the command is
   not primary.

 @since 2.6.0
 @api private