module Mongo::Operation::Write::Bulk::Delete::Aggregatable

Defines common r_removed aggreation behaviour.

@since 2.2.0

Public Instance Methods

n_removed() click to toggle source

Gets the number of documents deleted.

@example Get the deleted count.

result.n_removed

@return [ Integer ] The number of documents deleted.

@since 2.0.0

# File lib/mongo/operation/write/bulk/delete/result.rb, line 34
def n_removed
  return 0 unless acknowledged?
  @replies.reduce(0) do |n, reply|
    if reply.documents.first[Result::N]
      n += reply.documents.first[Result::N]
    else
      n
    end
  end
end