Class: Mongo::Error::InvalidUpdateDocument

继承:
错误
  • 对象
显示全部
定义于:
lib/mongo/error/invalid_update_document.rb

Overview

如果对象不是有效的更新文档,则引发异常。

由于:

  • 2.0.0

常量摘要折叠

MESSAGE =
已弃用。

错误消息。

由于:

  • 2.0.0

'提供的更新文档无效'

类方法摘要折叠

实例方法摘要折叠

构造函数详情

#initialize(key: nil) ⇒ InvalidUpdateDocument

实例化新异常。

参数:

  • :key ( string )

    无效的密钥。

由于:

  • 2.0.0



54
55
56
# File 'lib/mongo/error/invalid_update_document.rb', line 54

def 初始化(键: nil)
  (self.class.message(key))
end

类方法详细信息

message (key) ⇒ string

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

构建错误消息。

参数:

  • key ( string )

    无效的密钥。

返回:

  • ( string )

    错误消息。

由于:

  • 2.0.0



35
36
37
38
39
# File 'lib/mongo/error/invalid_update_document.rb', line 35

def self.message(key)
  message = ' 提供的更新文档无效。更新文档必须仅 '
  message += "仅包含原子修饰符。\" #{ key } \" 键无效。 "
  message
end

warn (logger, key) ⇒对象

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

发送并缓存警告。

由于:

  • 2.0.0



44
45
46
47
48
49
# File 'lib/mongo/error/invalid_update_document.rb', line 44

def self.WARN(记录器, key)
  @warned ||= 开始
    记录器.WARN(message(key))
    true
  end
end