Class: Mongo::BulkWrite::OrderedCombiner Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
|
|
Inherits: | Object |
Defined in: | lib/mongo/bulk_write/ordered_combiner.rb |
Overview
Combines groups of bulk write operations in order.
Constant Summary
Transformable
- Included
DELETE_MANY, DELETE_MANY_TRANSFORM, DELETE_ONE, DELETE_ONE_TRANSFORM, INSERT_ONE, INSERT_ONE_TRANSFORM, MAPPERS, REPLACE_ONE, REPLACE_ONE_TRANSFORM, UPDATE_MANY, UPDATE_MANY_TRANSFORM, UPDATE_ONE, UPDATE_ONE_TRANSFORM
Instance Attribute Summary
Combineable
- Included
Instance Method Summary
-
#combine ⇒ Array<Hash>
Internal use only
Combine the requests in order.
- #add(operations, name, document) private Internal use only
- #next_group?(name, operations) ⇒ Boolean private Internal use only
Combineable
- Included
#initialize | Create the ordered combiner. |
#combine_requests |
Validatable
- Included
#validate | Validate the document. |
#validate_document, #validate_operation |
Transformable
- Included
Instance Method Details
#add(operations, name, document) (private)
# File 'lib/mongo/bulk_write/ordered_combiner.rb', line 47
def add(operations, name, document) operations.push({ name => []}) if next_group?(name, operations) operations[-1][name].push(transform(name, document)) operations end
#combine ⇒ Array
<Hash
>
Combine the requests in order.
# File 'lib/mongo/bulk_write/ordered_combiner.rb', line 41
def combine combine_requests([]) end
#next_group?(name, operations) ⇒ Boolean
(private)
# File 'lib/mongo/bulk_write/ordered_combiner.rb', line 53
def next_group?(name, operations) !operations[-1] || !operations[-1].key?(name) end