Sha256: 9e7c494484895c3dcdbf59cad0fad95f1d13d5fae16ca9fc88ddccfd03aea9e9
Contents?: true
Size: 951 Bytes
Versions: 11
Compression:
Stored size: 951 Bytes
Contents
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'mongo' require 'pp' include Mongo host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost' port = ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT puts "Connecting to #{host}:#{port}" db = Mongo::Connection.new(host, port).db('ruby-mongo-examples') coll = db.create_collection('test') # Erase all records from collection, if any coll.remove admin = db.admin # Profiling level set/get puts "Profiling level: #{admin.profiling_level}" # Start profiling everything admin.profiling_level = :all # Read records, creating a profiling event coll.find().to_a # Stop profiling admin.profiling_level = :off # Print all profiling info pp admin.profiling_info # Validate returns a hash if all is well and # raises an exception if there is a problem. info = admin.validate_collection(coll.name) puts "valid = #{info['ok']}" puts info['result'] # Destroy the collection coll.drop
Version data entries
11 entries across 11 versions & 3 rubygems