Sha256: 4f7131433c1069128b860a447a70fc6a793f2b33da293c2a1cb82360aa3f2507

Contents?: true

Size: 519 Bytes

Versions: 5

Compression:

Stored size: 519 Bytes

Contents

# frozen_string_literal: true

module MongosMacros

  class << self
    attr_accessor :distinct_ran
  end
  self.distinct_ran = {}

  # Work around for SERVER-39704 when seeing a Mongo::Error::OperationFailure
  # SnapshotUnavailable error -- run the distinct command on each mongos.
  def run_mongos_distincts(db_name, collection='test')
    MongosMacros.distinct_ran[db_name] ||= ::Utils.mongos_each_direct_client do |direct_client|
      direct_client.use(db_name)[collection].distinct('foo').to_a
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongo-2.18.3 spec/support/mongos_macros.rb
mongo-2.18.2 spec/support/mongos_macros.rb
mongo-2.18.1 spec/support/mongos_macros.rb
mongo-2.18.0 spec/support/mongos_macros.rb
mongo-2.18.0.beta1 spec/support/mongos_macros.rb