mongo-ruby-driver/test/load/thin/load.rb

22 lines
575 B
Ruby
Raw Normal View History

require File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'mongo')
require 'logger'
2011-11-07 22:44:51 +00:00
$con = Mongo::ReplSetConnection.new(['localhost', 30000], ['localhost', 30001], :read => :secondary, :refresh_mode => :async, :refresh_interval => 30)
$db = $con['foo']
class Load < Sinatra::Base
configure do
LOGGER = Logger.new("sinatra.log")
enable :logging, :dump_errors
set :raise_errors, true
end
get '/' do
2011-11-07 22:44:51 +00:00
$db['test'].insert({:a => rand(1000)})
$db['test'].find({:a => {'$gt' => rand(2)}}, :read => :secondary).limit(2).to_a
"ok"
end
end