mongo-ruby-driver/test/mongo-qa/admin
2009-08-18 10:07:01 -04:00

27 lines
608 B
Ruby

#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), '_common.rb')
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
db.collection('test').insert({'test' => 1})
admin = db.admin
if $DEBUG
db.drop_collection('tester')
admin.profiling_level = :slow_only
end
['test', 'pdlskwmf', '$'].each { |name|
begin
admin.validate_collection(name)
puts 'true'
rescue => ex
puts 'false'
end
}
level_xlation = {:off => 'off', :all => 'all', :slow_only => 'slowOnly'}
puts level_xlation[admin.profiling_level]
admin.profiling_level = :off
puts level_xlation[admin.profiling_level]