Sha256: 867a8ca02a89c3a370614a0076ab2549c97492ae90ece4ff1b50cdf0487d6c41

Contents?: true

Size: 965 Bytes

Versions: 12

Compression:

Stored size: 965 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}"
con  = Mongo::Connection.new(host, port)
db   = con.db('ruby-mongo-examples')
coll = db.create_collection('test')

# Erase all records from collection, if any
coll.remove

admin = con['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 = db.validate_collection(coll.name)
puts "valid = #{info['ok']}"
puts info['result']

# Destroy the collection
coll.drop

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mongo-1.1.1 examples/admin.rb
mongo-1.1 examples/admin.rb
mongo-1.0.9 examples/admin.rb
mongo-1.0.8 examples/admin.rb
mongo-1.0.7 examples/admin.rb
mongo-1.0.6 examples/admin.rb
mongo-1.0.5 examples/admin.rb
mongo-1.0.4 examples/admin.rb
mongo-1.0.3 examples/admin.rb
mongo-1.0.2 examples/admin.rb
mongo-1.0.1 examples/admin.rb
mongo-1.0 examples/admin.rb