26 lines
647 B
Ruby
26 lines
647 B
Ruby
#!/usr/bin/env ruby
|
|
|
|
require File.join(File.dirname(__FILE__), '_common.rb')
|
|
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
|
|
|
if $DEBUG
|
|
c = db.collection('remove1')
|
|
c.clear
|
|
50.times { |i| c.insert(:a => i) }
|
|
c = db.collection('remove2')
|
|
c.clear
|
|
c.insert(:a => 3, :b => 1)
|
|
c.insert(:a => 3, :b => 3)
|
|
c.insert(:a => 2, :b => 3)
|
|
c.insert(:b => 3)
|
|
end
|
|
|
|
db.collection('remove1').clear
|
|
db.collection('remove2').remove('a' => 3)
|
|
|
|
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
|