123456789_123456789_123456789_123456789_123456789_

Exception: Mongo::Error::UnsupportedOption

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, ::Mongo::Error, StandardError
Instance Chain:
Inherits: Mongo::Error
  • Object
Defined in: lib/mongo/error/unsupported_option.rb

Overview

Raised if an unsupported option is specified for an operation.

Since:

  • 2.0.0

Constant Summary

  • ALLOW_DISK_USE_MESSAGE = Internal use only

    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.

    Since:

    • 2.0.0

    # File 'lib/mongo/error/unsupported_option.rb', line 46
    "The MongoDB server handling this request does " \
    "not support the allow_disk_use option on this command. The " \
    "allow_disk_use option is supported on find commands on MongoDB " \
    "server versions 4.4 and later"
  • COMMIT_QUORUM_MESSAGE = Internal use only

    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.

    Since:

    • 2.0.0

    # File 'lib/mongo/error/unsupported_option.rb', line 56
    "The MongoDB server handling this request does " \
    "not support the commit_quorum option on this command. The commit_quorum " \
    "option is supported on createIndexes commands on MongoDB server versions " \
    "4.4 and later"
  • HINT_MESSAGE = Internal use only

    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.

    Since:

    • 2.0.0

    # File 'lib/mongo/error/unsupported_option.rb', line 28
    "The MongoDB server handling this request does not support " \
    "the hint option on this command. The hint option is supported on update " \
    "commands on MongoDB server versions 4.2 and later and on findAndModify " \
    "and delete commands on MongoDB server versions 4.4 and later"
  • UNACKNOWLEDGED_HINT_MESSAGE = Internal use only

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

    Since:

    • 2.0.0

    # File 'lib/mongo/error/unsupported_option.rb', line 37
    "The hint option cannot be specified on " \
    "an unacknowledged write operation. Remove the hint option or perform " \
    "this operation with a write concern of at least { w: 1 }"

::Mongo::Error - Inherited

BAD_VALUE, CODE, CURSOR_NOT_FOUND, ERR, ERRMSG, ERROR, TRANSIENT_TRANSACTION_ERROR_LABEL, UNKNOWN_ERROR, UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL, WRITE_CONCERN_ERROR, WRITE_CONCERN_ERRORS, WRITE_ERRORS

Class Method Summary

::Mongo::Error - Inherited

Instance Attribute Summary

::Mongo::Error - Inherited

#change_stream_resumable?

Can the change stream on which this error occurred be resumed, provided the operation that triggered this error was a getMore?

ChangeStreamResumable - Included

#change_stream_resumable?

Can the change stream on which this error occurred be resumed, provided the operation that triggered this error was a getMore?

WriteRetryable - Included

Notable - Included

#connection_global_id

Returns global id of the connection on which the error occurred.

#generation

Returns connection pool generation for the connection on which the error occurred.

#service_id

Returns service id for the connection on which the error occurred.

Instance Method Summary

::Mongo::Error - Inherited

#write_concern_error_label?

Does the write concern error have the given label?

#write_concern_error_labels

The set of error labels associated with the write concern error.

Labelable - Included

#add_label

Adds the specified label to the error instance, if the label is not already in the set of labels.

#label?

Does the error have the given label?

#labels

Gets the set of labels associated with the error.

Notable - Included

#add_note,
#add_notes

Allows multiple notes to be added in a single call, for convenience.

#notes

Returns an array of strings with additional information about the exception.

#to_s, #notes_tail

Constructor Details

This class inherits a constructor from Mongo::Error

Class Method Details

.allow_disk_use_errorUnsupportedOption

This method is for internal use only.

Raise an error about an unsupported allow_disk_use option.

Returns:

  • (UnsupportedOption)

    An error with a default error message.

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/error/unsupported_option.rb', line 89

def self.allow_disk_use_error
  new(ALLOW_DISK_USE_MESSAGE)
end

.commit_quorum_errorUnsupportedOption

This method is for internal use only.

Raise an error about an unsupported commit_quorum option.

Returns:

  • (UnsupportedOption)

    An error with a default error message.

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/error/unsupported_option.rb', line 99

def self.commit_quorum_error
  new(COMMIT_QUORUM_MESSAGE)
end

.hint_error(**options) ⇒ UnsupportedOption

This method is for internal use only.

Raise an error about an unsupported hint option.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • unacknowledged_write (Boolean)

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

Returns:

  • (UnsupportedOption)

    An error with a default error message.

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/error/unsupported_option.rb', line 71

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