类:Mongo::Operation::Update::Result
Overview
定义更新结果的自定义行为。
常量摘要折叠
- 已修改 =
此常量是私有 API 的一部分。 应尽可能避免使用此常量,因为它将来可能会被删除或更改。
结果中已修改Docs字段的数量。
' nModified '.冻结
- UPSERTED =
此常量是私有 API 的一部分。 应尽可能避免使用此常量,因为它将来可能会被删除或更改。
结果中更新或插入的Docs字段。
' upsert '.冻结
从Result继承的常量
Result::CURSOR 、 Result::CURSOR_ID 、 Result::FIRST_BATCH 、 Result::N 、 Result::NAMESPACE 、 Result::NEXT_BATCH 、 Result::OK 、 Result::RESULT
实例属性摘要
从Result继承的属性
#connection 、 #connection_description 、 #connection_global_id 、 #context 、 #replies
实例方法摘要折叠
- # bulk_result ⇒ 对象
-
#matched_count ⇒ 整数
获取匹配的文档数量。
-
#modified_count ⇒ Integer
获取已修改文档的数量。
-
#upserted_count ⇒ Integer
返回已更新或插入的文档数。
-
# upserted_id ⇒ 对象
所插入文档的标识符(如果进行更新或插入)。
从Result继承的方法
#acknowledged? 、#cluster_time、 # cursor_id、#documents、# each 、# error 、 # has_cursor_id ? , #initialize , #inspect , #labels , 命名空间 , #ok? , #operation_time , #reply , #returned_count , #snapshot_timestamp , # success ? 、 #topology_version 、 #validate! , #write_concern_error? , #liter_count
构造函数详情
该类从Mongo::Operation::Result继承了一个构造函数
实例方法详细信息
# bulk_result ⇒对象
101 102 103 |
# File 'lib/ Mongo/operation/ 更新/result.rb', line 101 def bulk_result BulkResult.new(@replies, connection_description) end |
#matched_count ⇒整数
获取匹配的文档数量。
49 50 51 52 53 54 55 56 |
# File 'lib/ Mongo/operation/ 更新/result.rb', line 49 def 匹配计数 return 0 除非 已确认? if upsert? 0 else n end end |
# Modified_count =" Integer "(整数)
获取已修改文档的数量。
67 68 69 70 |
# File 'lib/ Mongo/operation/ 更新/result.rb', line 67 def Modified_count return 0 除非 已确认? first[MODIFIED] end |
#upserted_count ⇒ Integer
返回已更新或插入的文档数。
96 97 98 |
# File 'lib/ Mongo/operation/ 更新/result.rb', line 96 def upserted_count upsert? ? n : 0 end |
# upserted_id ⇒对象
所插入文档的标识符(如果更新或插入(upsert))
took place.
82 83 84 85 |
# File 'lib/ Mongo/operation/ 更新/result.rb', line 82 def upserted_id return nil 除非 upsert? upsert?.first['_id'] end |