类:Mongo::Operation::Insert::Result
Overview
定义插入结果的自定义行为。
根据 CRUD 规范,报告插入的 ID 是可选的。 如果需要,可以稍后将其添加到此类中。
常量摘要
从Result继承的常量
Result::CURSOR 、 Result::CURSOR_ID 、 Result::FIRST_BATCH 、 Result::N 、 Result::NAMESPACE 、 Result::NEXT_BATCH 、 Result::OK 、 Result::RESULT
实例属性摘要折叠
-
# Insert_Ids ⇒ 对象
只读
获取插入文档的 ID。
从Result继承的属性
#connection 、 #connection_description 、 #connection_global_id 、 #context 、 #replies
实例方法摘要折叠
- # bulk_result ⇒ 对象
-
#initialize (replies, connection_description, connection_global_id, ids, context: nil) ⇒ 结果
构造函数
private
初始化新结果。
-
# Insert_id ⇒ 对象
获取插入的文档的 ID。
从Result继承的方法
#acknowledged? 、#cluster_time、 # cursor_id、#documents、# each 、# error 、 # has_cursor_id ? 、 #inspect 、 #labels 、# namespace 、# ok? 、 #operation_time 、 #reply 、 #returned_count 、 #snapshot_timestamp 、 #successful? 、 #topology_version 、 #validate! , #write_concern_error? , #liter_count
构造函数详情
#initialize (replies, connection_description, connection_global_id, ids, context: nil) ⇒ 结果
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
初始化新结果。
55 56 57 58 |
# File 'lib/ Mongo/operation/insert/result.rb', line 55 def 初始化(回复, connection_description, connection_global_id, id, 上下文: nil) 超(回复, connection_description, connection_global_id, 上下文: 上下文) @inserted_ids = id end |
实例属性详细信息
# Insert_Ids ⇒对象(只读)
获取插入文档的 ID。
35 36 37 |
# File 'lib/ Mongo/operation/insert/result.rb', line 35 def Inserted_Ids @inserted_ids end |
实例方法详细信息
# bulk_result ⇒对象
74 75 76 |
# File 'lib/ Mongo/operation/insert/result.rb', line 74 def bulk_result BulkResult.new(@replies, connection_description, connection_global_id, @inserted_ids) end |
# Insert_id ⇒对象
获取插入的文档的 ID。
69 70 71 |
# File 'lib/ Mongo/operation/insert/result.rb', line 69 def Inserted_id Inserted_Ids.first end |