Exception: Mongo::Error::UnsupportedOption

Inherits:
Mongo::Error
  • Object
show all
Defined in:
build/ruby-driver-master/lib/mongo/error/unsupported_option.rb

Overview

Raised if an unsupported option is specified for an operation.

Since:

  • 2.0.0

Constant Summary collapse

HINT_MESSAGE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

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

"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 =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

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

Since:

  • 2.0.0

"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 }"
ALLOW_DISK_USE_MESSAGE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

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

"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 =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

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

"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"

Constants inherited from Mongo::Error

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

Instance Attribute Summary

Attributes included from Notable

#generation, #service_id

Class Method Summary collapse

Methods inherited from Mongo::Error

#add_label, #change_stream_resumable?, #initialize, #label?, #labels, #write_concern_error_label?, #write_concern_error_labels

Methods included from Notable

#add_note, #notes, #to_s

Constructor Details

This class inherits a constructor from Mongo::Error

Class Method Details

.allow_disk_use_errorMongo::Error::UnsupportedOption

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raise an error about an unsupported allow_disk_use option.

Returns:

Since:

  • 2.0.0



89
90
91
# File 'build/ruby-driver-master/lib/mongo/error/unsupported_option.rb', line 89

def self.allow_disk_use_error
  new(ALLOW_DISK_USE_MESSAGE)
end

.commit_quorum_errorMongo::Error::UnsupportedOption

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raise an error about an unsupported commit_quorum option.

Returns:

Since:

  • 2.0.0



99
100
101
# File 'build/ruby-driver-master/lib/mongo/error/unsupported_option.rb', line 99

def self.commit_quorum_error
  new(COMMIT_QUORUM_MESSAGE)
end

.hint_error(**options) ⇒ Mongo::Error::UnsupportedOption

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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:

Since:

  • 2.0.0



71
72
73
74
75
76
77
78
79
80
81
# File 'build/ruby-driver-master/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