类:Mongo::Operation::Delete::BulkResult

继承:
结果
  • 对象
显示全部
包括:
可聚合
定义于:
lib/ Mongo/operation/ 删除/bulk_result.rb

Overview

定义批量写入时删除结果的自定义行为。

由于:

  • 2.0.0

常量摘要

从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

实例方法摘要折叠

从Result继承的方法

#acknowledged?, #base_backoff_ms, #cluster_time, #cursor_id, #documents, #each, #error, #initialize, #inspect, #labels, 命名空间, #ok?, #operation_time, #reply, #returned_count, #snapshot_timestamp, #成功?, #topology_version, #validate!, #write_concern_error?, #wred_count

构造函数详情

该类从Mongo::Operation::Result继承了一个构造函数

实例方法详细信息

# n_removed ⇒整数

获取已删除的文档数。

例子:

获取已删除的计数。

result.n_removed

返回:

  • ( Integer ) —

    删除的文档数量。

由于:

  • 2.0.0



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ Mongo/operation/ 删除/bulk_result.rb', line 36

def n_removed
  return 0 除非 已确认?

  @replies.化简(reduce)(0) do |n, 回复|
    if 回复.文档.first[结果::N]
      n + 回复.文档.first[结果::N]
    else
      n
    end
  end
end