InvalidReplacementDocument — Documentation by YARD 0.9.37 (original) (raw)

Exception: Mongo::Error::InvalidReplacementDocument

Inherits:

Mongo::Error

Defined in:

lib/mongo/error/invalid_replacement_document.rb

Overview

Exception raised if the object is not a valid replacement document.

Constant Summarycollapse

MESSAGE =

'Invalid replacement document provided'.freeze

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

#connection_global_id, #generation, #service_id

Class Method Summarycollapse

Instance Method Summarycollapse

Methods inherited from Mongo::Error

#change_stream_resumable?, #network_error?, #write_concern_error_label?, #write_concern_error_labels

Methods included from ChangeStreamResumable

#change_stream_resumable?

Methods included from WriteRetryable

#write_retryable?

Methods included from Labelable

#add_label, #label?, #labels

Methods included from Notable

#add_note, #add_notes, #notes, #to_s

Constructor Details

#initialize(key: nil) ⇒ InvalidReplacementDocument

Instantiate the new exception.

55 56 57 # File 'lib/mongo/error/invalid_replacement_document.rb', line 55 def initialize(key: nil) super(self.class.message(key)) end

Class Method Details

.message(key) ⇒ String

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.

Construct the error message.

36 37 38 39 40 # File 'lib/mongo/error/invalid_replacement_document.rb', line 36 def self.message(key) message = "Invalid replacement document provided. Replacement documents " message += "must not contain atomic modifiers. The \"#{key}\" key is invalid." message end

.warn(logger, key) ⇒ Object

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.

Send and cache the warning.

| 45 46 47 48 49 50 | # File 'lib/mongo/error/invalid_replacement_document.rb', line 45 def self.warn(logger, key) @warned ||= begin logger.warn(message(key)) true end end | | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |