2009-02-05 19:24:59 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
LONG_STRING = "lksjhasoh1298alshasoidiohaskjasiouashoasasiugoas" * 6
|
|
|
|
|
|
|
|
require File.join(File.dirname(__FILE__), '_common.rb')
|
|
|
|
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
|
|
|
c = db.collection('stress1')
|
|
|
|
|
2009-02-05 19:47:33 +00:00
|
|
|
if __FILE__ == $0
|
|
|
|
c.drop
|
|
|
|
end
|
|
|
|
|
2009-02-05 19:24:59 +00:00
|
|
|
50000.times { |i|
|
|
|
|
c.insert(:name => "asdf#{i}", :date => Time.now, :_id => i,
|
|
|
|
:blah => LONG_STRING, :subarray => [])
|
|
|
|
}
|
|
|
|
puts
|
|
|
|
|
|
|
|
10000.times { |i|
|
|
|
|
cursor = c.find({:_id => i})
|
|
|
|
x = cursor.next_object
|
|
|
|
cursor.close
|
|
|
|
x['subarray'] = "foo#{i}"
|
|
|
|
c.insert(x)
|
|
|
|
}
|
|
|
|
puts
|