123456789_123456789_123456789_123456789_123456789_

Module: Mongo::BulkWrite::Combineable Private

Do not use. This module is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/mongo/bulk_write/combineable.rb

Overview

Defines behavior around combiners

Since:

  • 2.1.0

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#has_array_filters?Boolean (readonly)

Returns:

  • (Boolean)

    Whether one or more operation specifies the array_filters option.

Since:

  • 2.1.0

[ GitHub ]

  
# File 'lib/mongo/bulk_write/combineable.rb', line 56

def has_array_filters?
  @has_array_filters
end

#has_collation?Boolean (readonly)

Returns:

  • (Boolean)

    Whether one or more operation specifies the collation option.

Since:

  • 2.1.0

[ GitHub ]

  
# File 'lib/mongo/bulk_write/combineable.rb', line 50

def has_collation?
  @has_collation
end

#has_hint?Boolean (readonly)

Returns:

  • (Boolean)

    Whether one or more operation specifies the hint option.

Since:

  • 2.1.0

[ GitHub ]

  
# File 'lib/mongo/bulk_write/combineable.rb', line 62

def has_hint?
  @has_hint
end

#requestsArray<Hash, BSON::Document> (readonly)

Returns:

  • (Array<Hash, BSON::Document>)

    requests The provided requests.

Since:

  • 2.1.0

[ GitHub ]

  
# File 'lib/mongo/bulk_write/combineable.rb', line 29

attr_reader :requests

Instance Method Details

#combine_requests(ops) (private)

Since:

  • 2.1.0

[ GitHub ]

  
# File 'lib/mongo/bulk_write/combineable.rb', line 68

def combine_requests(ops)
  requests.reduce(ops) do |operations, request|
    add(operations, request.keys.first, request.values.first)
  end
end

#initialize(requests)

Create the ordered combiner.

Examples:

Create the ordered combiner.

OrderedCombiner.new([{ insert_one: { _id: 0 }}])

Parameters:

  • requests (Array<Hash, BSON::Document>)

    The bulk requests.

Since:

  • 2.1.0

[ GitHub ]

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

def initialize(requests)
  @requests = requests
  @has_collation = false
  @has_array_filters = false
  @has_hint = false
end