mongo-ruby-driver/test/mongo-qa/update

19 lines
401 B
Plaintext
Raw Permalink Normal View History

#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), '_common.rb')
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
foo = db.collection('foo')
if $DEBUG
foo.drop
foo.insert(:x => 1)
end
foo.modify({:x => 1}, {:x => 1, :y => 2})
foo.modify({:x => 2}, {:x => 1, :y => 7})
foo.repsert({:x => 3}, {:x => 4, :y => 1})
if $DEBUG
foo.find.each { |row| puts row.inspect }
end