class Mongo::BulkWrite::OrderedCombiner

Combines groups of bulk write operations in order.

@api private

@since 2.1.0

Public Instance Methods

combine() click to toggle source

Combine the requests in order.

@api private

@example Combine the requests.

combiner.combine

@return [ Array<Hash> ] The combined requests.

@since 2.1.0

# File lib/mongo/bulk_write/ordered_combiner.rb, line 38
def combine
  combine_requests([])
end

Private Instance Methods

add(operations, name, document) click to toggle source
# File lib/mongo/bulk_write/ordered_combiner.rb, line 44
def add(operations, name, document)
  operations.push({ name => []}) if next_group?(name, operations)
  operations[-1][name].push(transform(name, document))
  operations
end
next_group?(name, operations) click to toggle source
# File lib/mongo/bulk_write/ordered_combiner.rb, line 50
def next_group?(name, operations)
  !operations[-1] || !operations[-1].key?(name)
end