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

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

Overview

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

由于:

  • 2.0.0

常量摘要

Result继承的常量

Result::CURSORResult::CURSOR_IDResult::FIRST_BATCHResult::NResult::NAMESPACEResult::NEXT_BATCHResult::OKResult::RESULT

实例属性摘要

Result继承的属性

#connection #connection_description #connection_global_id #context #replies

实例方法摘要折叠

Result继承的方法

#acknowledged?#cluster_time#cursor_id#文档#each#error#initialize#inspect#labels#命名空间#ok?#operation_time#reply#returned_count#snapshot_timestamp#成功?#topology_version#validate!#write_concern_error?#written_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