module Mongo::BulkWrite::Combineable
Defines behavior around combiners
@api private
@since 2.1.0
Attributes
requests[R]
@return [ Array<Hash, BSON::Document> ] requests The provided requests.
Public Class Methods
new(requests)
click to toggle source
Create the ordered combiner.
@api private
@example Create the ordered combiner.
OrderedCombiner.new([{ insert_one: { _id: 0 }}])
@param [ Array<Hash, BSON::Document> ] requests The bulk requests.
@since 2.1.0
# File lib/mongo/bulk_write/combineable.rb, line 38 def initialize(requests) @requests = requests @has_collation = false @has_array_filters = false @has_hint = false end
Public Instance Methods
has_array_filters?()
click to toggle source
@return [ Boolean ] Whether one or more operation specifies the
array_filters option.
# File lib/mongo/bulk_write/combineable.rb, line 53 def has_array_filters? @has_array_filters end
has_collation?()
click to toggle source
@return [ Boolean ] Whether one or more operation specifies the collation
option.
# File lib/mongo/bulk_write/combineable.rb, line 47 def has_collation? @has_collation end
has_hint?()
click to toggle source
@return [ Boolean ] Whether one or more operation specifies the
hint option.
# File lib/mongo/bulk_write/combineable.rb, line 59 def has_hint? @has_hint end
Private Instance Methods
combine_requests(ops)
click to toggle source
# File lib/mongo/bulk_write/combineable.rb, line 65 def combine_requests(ops) requests.reduce(ops) do |operations, request| add(operations, request.keys.first, request.values.first) end end