Skip to content

Instantly share code, notes, and snippets.

@estolfo
Last active Mar 21, 2018
Embed
What would you like to do?
client = Mongo::Client.new(["localhost:3000", "localhost:3001", "localhost:3002"], truncate_logs: false)
coll = client[:test, read: { mode: :secondary_preferred }]
sleep_intervals = [ 10, 700, 1 ]
coll.find({}, no_cursor_timeout: true, batch_size: 1).each_with_index do |doc, i|
doc
puts "sleeping for #{sleep_intervals[i]} seconds"
sleep(sleep_intervals[i])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment