ResultCombiner — Documentation by YARD 0.9.37 (original) (raw)

Class: Mongo::BulkWrite::ResultCombinerPrivate

Inherits:

Object

Defined in:

lib/mongo/bulk_write/result_combiner.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Combines bulk write results together.

Instance Attribute Summary collapse

Instance Method Summarycollapse

Constructor Details

#initialize ⇒ ResultCombiner

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create the new result combiner.

42 43 44 45 # File 'lib/mongo/bulk_write/result_combiner.rb', line 42 def initialize @results = {} @count = 0 end

Instance Attribute Details

#count ⇒ Integer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns count The number of documents in the entire batch.

29 30 31 # File 'lib/mongo/bulk_write/result_combiner.rb', line 29 def count @count end

#results ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns results The results hash.

32 33 34 # File 'lib/mongo/bulk_write/result_combiner.rb', line 32 def results @results end

Instance Method Details

#combine!(result, count) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Adds a result to the overall results.

58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 # File 'lib/mongo/bulk_write/result_combiner.rb', line 58 def combine!(result, count) unless result.write_concern_error? combine_counts!(result) combine_ids!(result) end combine_errors!(result) @count += count @acknowledged = result.acknowledged? end

#resultBulkWrite::Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get the final result.

83 84 85 # File 'lib/mongo/bulk_write/result_combiner.rb', line 83 def result BulkWrite::Result.new(results, @acknowledged).validate! end