Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (19 sloc) 0.526 kB
# This code assumes a running replica set with at least one node at localhost:27017.
require 'mongo'
include Mongo
cons = []
10.times do
cons << MongoReplicaSetClient(['localhost:27017'], :read => :secondary)
end
ports = cons.map do |con|
con.read_pool.port
end
puts "These ten connections will read from the following ports:"
p ports
cons[rand(10)]['foo']['bar'].remove
100.times do |n|
cons[rand(10)]['foo']['bar'].insert({:a => n})
end
100.times do |n|
p cons[rand(10)]['foo']['bar'].find_one({:a => n})
end
Jump to Line
Something went wrong with that request. Please try again.