Class: Mongo::BulkWrite::ResultCombiner Private
- Inherits:
-
Object
- Object
- Mongo::BulkWrite::ResultCombiner
- 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
-
#count ⇒ Integer
readonly
private
Count The count of documents in the entire batch.
-
#results ⇒ Hash
readonly
private
Results The results hash.
Instance Method Summary collapse
-
#combine!(result, count) ⇒ Object
private
Combines a result into the overall results.
-
#initialize ⇒ ResultCombiner
constructor
private
Create the new result combiner.
-
#result ⇒ BulkWrite::Result
private
Get the final result.
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.
39 40 41 42 |
# File 'lib/mongo/bulk_write/result_combiner.rb', line 39 def initialize @results = {} @count = 0 end |
Instance Attribute Details
#count ⇒ Integer (readonly)
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 count of documents in the entire batch.
26 27 28 |
# File 'lib/mongo/bulk_write/result_combiner.rb', line 26 def count @count end |
#results ⇒ Hash (readonly)
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.
29 30 31 |
# File 'lib/mongo/bulk_write/result_combiner.rb', line 29 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.
Combines a result into the overall results.
55 56 57 58 59 60 |
# File 'lib/mongo/bulk_write/result_combiner.rb', line 55 def combine!(result, count) combine_counts!(result) combine_ids!(result) combine_errors!(result) @count += count end |
#result ⇒ BulkWrite::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.
72 73 74 |
# File 'lib/mongo/bulk_write/result_combiner.rb', line 72 def result BulkWrite::Result.new(results).validate! end |