123456789_123456789_123456789_123456789_123456789_

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.

Since:

  • 2.1.0

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

Instance Method Summary

Combineable - Included

#initialize

Create the ordered combiner.

#combine_requests

Validatable - Included

Transformable - Included

Instance Method Details

#add(operations, name, document) (private)

Since:

  • 2.1.0

[ GitHub ]

  
# 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

#combineArray<Hash>

Combine the requests in order.

Examples:

Combine the requests.

combiner.combine

Returns:

  • (Array<Hash>)

    The combined requests.

Since:

  • 2.1.0

[ GitHub ]

  
# File 'lib/mongo/bulk_write/ordered_combiner.rb', line 41

def combine
  combine_requests([])
end

#next_group?(name, operations) ⇒ Boolean (private)

Since:

  • 2.1.0

[ GitHub ]

  
# File 'lib/mongo/bulk_write/ordered_combiner.rb', line 53

def next_group?(name, operations)
  !operations[-1] || !operations[-1].key?(name)
end