module Workarea::Testing::Indexes

Public Class Methods

disable_enforcing!() click to toggle source
# File lib/workarea/testing/indexes.rb, line 8
def self.disable_enforcing!
  set(0)
end
enable_enforcing!() click to toggle source
# File lib/workarea/testing/indexes.rb, line 4
def self.enable_enforcing!
  set(1)
end
set(value) click to toggle source
# File lib/workarea/testing/indexes.rb, line 12
def self.set(value)
  servers = Mongoid::Clients.default.cluster.servers
  addresses = servers.map(&:address).map(&:to_s)

  client = Mongo::Client.new(addresses, database: 'admin')
  client.command(setParameter: 1, notablescan: value)
  client.close
end