mongo-ruby-driver/test/load/thin/load.rb
Tyler Brock 8db4eb771f RUBY-378: fixed documentation and tests for new ReplSetConnection seed format
Added helper method #build_seeds to rs_test_helper
Added new test for old connection
2012-02-18 18:35:29 -05:00

22 lines
570 B
Ruby

require File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'mongo')
require 'logger'
$con = Mongo::ReplSetConnection.new(['localhost:30000', 'localhost:30001'], :read => :secondary, :refresh_mode => :sync, :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
$db['test'].insert({:a => rand(1000)})
$db['test'].find({:a => {'$gt' => rand(2)}}, :read => :secondary).limit(2).to_a
"ok"
end
end