2009-02-05 19:24:59 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require File.join(File.dirname(__FILE__), '_common.rb')
|
|
|
|
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
|
|
|
foo = db.collection('foo')
|
|
|
|
|
2009-02-05 19:47:33 +00:00
|
|
|
if __FILE__ == $0
|
|
|
|
foo.drop
|
|
|
|
foo.insert(:x => 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
foo.replace({:x => 1}, {:x => 1, :y => 2})
|
|
|
|
foo.replace({:x => 2}, {:x => 1, :y => 7})
|
|
|
|
foo.replace({:x => 3}, {:x => 4, :y => 1})
|