mongo-ruby-driver/tests/mongo-qa/stress1

23 lines
511 B
Plaintext
Raw Normal View History

#!/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')
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