2009-02-05 19:24:59 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require File.join(File.dirname(__FILE__), '_common.rb')
|
2009-08-20 22:48:09 +00:00
|
|
|
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
2009-02-05 19:24:59 +00:00
|
|
|
|
|
|
|
db.collection('test').insert({'test' => 1})
|
|
|
|
admin = db.admin
|
|
|
|
|
2009-02-05 21:00:45 +00:00
|
|
|
if $DEBUG
|
2009-02-05 19:47:33 +00:00
|
|
|
db.drop_collection('tester')
|
|
|
|
admin.profiling_level = :slow_only
|
|
|
|
end
|
|
|
|
|
2009-02-05 19:24:59 +00:00
|
|
|
['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]
|