minor: Collection#remove returns true on nonsafe remove
This commit is contained in:
parent
ed06ae4342
commit
03bf0a18de
|
@ -321,6 +321,7 @@ module Mongo
|
||||||
@connection.send_message_with_safe_check(Mongo::Constants::OP_DELETE, message, @db.name, nil, safe)
|
@connection.send_message_with_safe_check(Mongo::Constants::OP_DELETE, message, @db.name, nil, safe)
|
||||||
else
|
else
|
||||||
@connection.send_message(Mongo::Constants::OP_DELETE, message)
|
@connection.send_message(Mongo::Constants::OP_DELETE, message)
|
||||||
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -263,13 +263,12 @@ class TestCollection < Test::Unit::TestCase
|
||||||
@db = @conn[MONGO_TEST_DB]
|
@db = @conn[MONGO_TEST_DB]
|
||||||
@test = @db['test-safe-remove']
|
@test = @db['test-safe-remove']
|
||||||
@test.save({:a => 50})
|
@test.save({:a => 50})
|
||||||
@test.remove({}, :safe => true)
|
assert_equal 1, @test.remove({}, :safe => true)["n"]
|
||||||
@test.drop
|
@test.drop
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_remove_return_value
|
def test_remove_return_value
|
||||||
assert_equal 50, @@test.remove({})
|
assert_equal true, @@test.remove({})
|
||||||
assert_equal 57, @@test.remove({"x" => 1})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_count
|
def test_count
|
||||||
|
|
Loading…
Reference in New Issue