class Mongo::Error::InvalidUpdateDocument

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

@since 2.0.0

Constants

MESSAGE

The error message.

@deprecated

Public Class Methods

message(key) click to toggle source

Construct the error message.

@param [ String ] key The invalid key.

@return [ String ] The error message.

@api private

# File lib/mongo/error/invalid_update_document.rb, line 38
def self.message(key)
  message = "Invalid update document provided. Updates documents must only "
  message += "contain only atomic modifiers. The \"#{key}\" key is invalid."
  message
end
new(key: nil) click to toggle source

Instantiate the new exception.

@param [ String ] :key The invalid key.

Calls superclass method Mongo::Error::new
# File lib/mongo/error/invalid_update_document.rb, line 57
def initialize(key: nil)
  super(self.class.message(key))
end
warn(logger, key) click to toggle source

Send and cache the warning.

@api private

# File lib/mongo/error/invalid_update_document.rb, line 47
def self.warn(logger, key)
  @warned ||= begin
    logger.warn(message(key))
    true
  end
end