2009-02-02 18:12:33 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require File.join(File.dirname(__FILE__), '_common.rb')
|
|
|
|
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
|
|
|
|
2009-02-05 21:00:45 +00:00
|
|
|
if $DEBUG
|
2009-02-05 19:47:33 +00:00
|
|
|
c = db.collection('remove1')
|
2009-02-05 21:00:45 +00:00
|
|
|
c.clear
|
2009-02-05 19:47:33 +00:00
|
|
|
50.times { |i| c.insert(:a => i) }
|
|
|
|
c = db.collection('remove2')
|
2009-02-05 21:00:45 +00:00
|
|
|
c.clear
|
2009-02-05 19:47:33 +00:00
|
|
|
c.insert(:a => 3, :b => 1)
|
|
|
|
c.insert(:a => 3, :b => 3)
|
|
|
|
c.insert(:a => 2, :b => 3)
|
|
|
|
c.insert(:b => 3)
|
|
|
|
end
|
|
|
|
|
2009-02-02 18:12:33 +00:00
|
|
|
db.collection('remove1').clear
|
|
|
|
db.collection('remove2').remove('a' => 3)
|
2009-02-05 21:00:45 +00:00
|
|
|
|
|
|
|
if $DEBUG
|
|
|
|
puts "remove1 count = #{db.collection('remove1').count}"
|
|
|
|
puts "remove2 count = #{db.collection('remove2').count}"
|
|
|
|
db.collection('remove2').find.each { |row| puts row.inspect }
|
|
|
|
end
|