Skip to content

Instantly share code, notes, and snippets.

@stanaka
Created February 22, 2013 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stanaka/5012125 to your computer and use it in GitHub Desktop.
Save stanaka/5012125 to your computer and use it in GitHub Desktop.
a sample script to send LARGE requests to mongodb. note: mongodb cannot deal with this request properly.
require 'moped'
session = Moped::Session.new([ "127.0.0.1:27017" ])
session.use "test"
str = ''
1_000_000.times do
str << '0123456789'
end
records = []
5.times do |i|
records << {'test' => str}
end
session.with(safe: true) do |safe|
safe[:artists].insert(records)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment