class Mongo::Error::UnsupportedOption

Raised if an unsupported option is specified for an operation.

Constants

ALLOW_DISK_USE_MESSAGE

The error message provided when the user passes the allow_disk_use option to a find operation against a server that does not support the allow_disk_use operation and does not provide option validation.

@api private

COMMIT_QUORUM_MESSAGE

The error message provided when the user passes the commit_quorum option to a createIndexes operation against a server that does not support that option.

@api private

HINT_MESSAGE

The error message provided when the user passes the hint option to a write operation against a server that does not support the hint option and does not provide option validation.

@api private

UNACKNOWLEDGED_HINT_MESSAGE

The error message provided when the user passes the hint option to an unacknowledged write operation.

@api private

Public Class Methods

allow_disk_use_error() click to toggle source

Raise an error about an unsupported allow_disk_use option.

@return [ Mongo::Error::UnsupportedOption ] An error with a default

error message.

@api private

# File lib/mongo/error/unsupported_option.rb, line 86
def self.allow_disk_use_error
  new(ALLOW_DISK_USE_MESSAGE)
end
commit_quorum_error() click to toggle source

Raise an error about an unsupported commit_quorum option.

@return [ Mongo::Error::UnsupportedOption ] An error with a default

error message.

@api private

# File lib/mongo/error/unsupported_option.rb, line 96
def self.commit_quorum_error
  new(COMMIT_QUORUM_MESSAGE)
end
hint_error(**options) click to toggle source

Raise an error about an unsupported hint option.

@option options [ Boolean ] unacknowledged_write Whether this error

pertains to a hint option passed to an unacknowledged write. Defaults
to false.

@return [ Mongo::Error::UnsupportedOption ] An error with a default

error message.

@api private

# File lib/mongo/error/unsupported_option.rb, line 68
def self.hint_error(**options)
  unacknowledged_write = options[:unacknowledged_write] || false

  error_message = if unacknowledged_write
    UNACKNOWLEDGED_HINT_MESSAGE
  else
    HINT_MESSAGE
  end

  new(error_message)
end