类:Mongoid::Contextual::None
- 继承:
-
对象
- 对象
- Mongoid::Contextual::None
- 包括:
- Enumerable、 Aggregable::None 、 Queryable
- 定义于:
- lib/mongoid/contextual/none.rb
Overview
用于对 null设立执行批量查询和持久性操作的 Context对象。 该类的方法接口与 Mongoid::Contextual::Mongo一致。
实例属性摘要折叠
-
# 个条件⇒ 对象
只读
返回属性条件的值。
-
# klass ⇒ 对象
只读
返回属性 klass 的值。
Queryable中包含的属性
# 集合 , # 集合要查询的集合。 , #criteria 上下文的条件。 , #klass 条件的 klass。
实例方法摘要折叠
-
# == (other) ⇒ true | false
检查上下文是否等于其他对象。
-
# distinct (_field) ⇒ 数组
获取 null 上下文中的非重复字段值。
-
#each ⇒ 枚举器
遍历 null 上下文。
-
#是否存在? (id_or_conditions = :none) ⇒ false
该上下文是否存在任何文档。
-
#第五个⇒ nil
始终返回零。
-
#第五! ⇒ 对象
始终引发错误。
-
# first (limit = nil) ⇒ [] | nil (也:#find_first、#one)
始终返回零。
-
# first! ⇒ 对象
始终引发错误。
-
#fourth ⇒ nil
始终返回零。
-
#fourth! ⇒ 对象
始终引发错误。
-
#initialize (criteria) ⇒ 无
构造函数
创建新的 null 上下文。
-
#last(limit = nil) ⇒ [] | nil
始终返回零。
-
# last! ⇒ 对象
始终引发错误。
-
# length ⇒ Integer (也称为:#size)
始终返回零。
-
# pick (*_fields) ⇒ nil
在 null 上下文中选取字段值。
-
# pluck (*_fields) ⇒ 数组
在 null 上下文中提取字段值。
-
#second ⇒ nil
始终返回零。
-
#秒! ⇒ 对象
始终引发错误。
-
# Second_to_last ⇒ nil
始终返回零。
-
# Second_to_last! ⇒ 对象
始终引发错误。
-
#take (limit = nil) ⇒ [] | nil
返回 nil 或空数组。
-
#take! ⇒ 对象
始终引发错误。
-
#tally (_field) ⇒ 哈希
统计 null 上下文中的字段值。
-
# Third ⇒ nil
始终返回零。
-
# Third! ⇒ 对象
始终引发错误。
-
# Third_to_last ⇒ nil
始终返回零。
-
# Third_to_last! ⇒ 对象
始终引发错误。
Queryable中包含的方法
Aggregable::None中包含的方法
#aggregates 、 #avg 、 #min 、 #sum
构造函数详情
#initialize (criteria) ⇒无
创建新的 null 上下文。
120 121 122 |
# File 'lib/mongoid/contextual/none.rb', line 120 def 初始化(条件) @criteria, @klass = 条件, 条件.klass end |
实例属性详细信息
# 个条件⇒对象(只读)
返回属性条件的值。
17 18 19 |
# File 'lib/mongoid/contextual/none.rb', line 17 def 条件 @criteria end |
# klass ⇒对象(只读)
返回属性 klass 的值。
17 18 19 |
# File 'lib/mongoid/contextual/none.rb', line 17 def klass @klass end |
实例方法详细信息
# == (other) ⇒ true | false
检查上下文是否等于其他对象。
27 28 29 |
# File 'lib/mongoid/contextual/none.rb', line 27 def ==(其他) 其他.is_a?(无) end |
# distinct (_field) ⇒数组
获取 null 上下文中的非重复字段值。
39 40 41 |
# File 'lib/mongoid/contextual/none.rb', line 39 def distinct(_field) [] end |
#each ⇒枚举器
遍历 null 上下文。 在这种情况下,没有要迭代的文档。
52 53 54 55 56 57 58 59 |
# File 'lib/mongoid/contextual/none.rb', line 52 def 每 if block_given? [].每 { |doc| 产量(doc) } self else to_enum end end |
#是否存在? (id_or_conditions = :none) ⇒ false
该上下文是否存在任何文档。
76 |
# File 'lib/mongoid/contextual/none.rb', line 76 def 存在吗?(id_or_conditions = : none); false; end |
#第五个⇒ nil
始终返回零。
256 257 258 |
# File 'lib/mongoid/contextual/none.rb', line 256 def 第五 nil end |
#第五! ⇒对象
始终引发错误。
266 267 268 |
# File 'lib/mongoid/contextual/none.rb', line 266 def 第五! Raise_document_not_Found_error end |
# first (limit = nil) ⇒ [] | nil也称为: find_first 、 one
始终返回零。
132 133 134 |
# File 'lib/mongoid/contextual/none.rb', line 132 def first(limit = nil) [] 除非 limit.nil? end |
# first! ⇒对象
始终引发错误。
142 143 144 |
# File 'lib/mongoid/contextual/none.rb', line 142 def 首先! Raise_document_not_Found_error end |
#fourth ⇒ nil
始终返回零。
236 237 238 |
# File 'lib/mongoid/contextual/none.rb', line 236 def 第四 nil end |
#fourth! ⇒对象
始终引发错误。
246 247 248 |
# File 'lib/mongoid/contextual/none.rb', line 246 def 第四! Raise_document_not_Found_error end |
#last(limit = nil) ⇒ [] | nil
始终返回零。
154 155 156 |
# File 'lib/mongoid/contextual/none.rb', line 154 def last(limit = nil) [] 除非 limit.nil? end |
# last! ⇒对象
始终引发错误。
164 165 166 |
# File 'lib/mongoid/contextual/none.rb', line 164 def last! Raise_document_not_Found_error end |
# length ⇒ Integer也称为:大小
始终返回零。
316 317 318 |
# File 'lib/mongoid/contextual/none.rb', line 316 def 长度 条目.长度 end |
# pick (*_fields) ⇒ nil
在 null 上下文中选取字段值。
98 99 100 |
# File 'lib/mongoid/contextual/none.rb', line 98 def pick(*_fields) nil end |
# pluck (*_fields) ⇒数组
在 null 上下文中提取字段值。
86 87 88 |
# File 'lib/mongoid/contextual/none.rb', line 86 def 采摘(*_fields) [] end |
#second ⇒ nil
始终返回零。
196 197 198 |
# File 'lib/mongoid/contextual/none.rb', line 196 def 秒 nil end |
#秒! ⇒对象
始终引发错误。
206 207 208 |
# File 'lib/mongoid/contextual/none.rb', line 206 def 第二! Raise_document_not_Found_error end |
# Second_to_last ⇒ nil
始终返回零。
276 277 278 |
# File 'lib/mongoid/contextual/none.rb', line 276 def Second_to_last nil end |
# Second_to_last! ⇒对象
始终引发错误。
286 287 288 |
# File 'lib/mongoid/contextual/none.rb', line 286 def Second_to_last! Raise_document_not_Found_error end |
#take(limit = nil) ⇒ [] | nil
返回 nil 或空数组。
176 177 178 |
# File 'lib/mongoid/contextual/none.rb', line 176 def 采取(limit = nil) limit ? [] : nil end |
#take! ⇒对象
始终引发错误。
186 187 188 |
# File 'lib/mongoid/contextual/none.rb', line 186 def 采取! Raise_document_not_Found_error end |
#tally (_field) ⇒哈希
统计 null 上下文中的字段值。
110 111 112 |
# File 'lib/mongoid/contextual/none.rb', line 110 def 计数(_field) {} end |
# Third ⇒ nil
始终返回零。
216 217 218 |
# File 'lib/mongoid/contextual/none.rb', line 216 def 第三 nil end |
# Third! ⇒对象
始终引发错误。
226 227 228 |
# File 'lib/mongoid/contextual/none.rb', line 226 def 第三! Raise_document_not_Found_error end |
# Third_to_last ⇒ nil
始终返回零。
296 297 298 |
# File 'lib/mongoid/contextual/none.rb', line 296 def Third_to_last nil end |
# Third_to_last! ⇒对象
始终引发错误。
306 307 308 |
# File 'lib/mongoid/contextual/none.rb', line 306 def Third_to_last! Raise_document_not_Found_error end |