From 03bf0a18debd8a44cb274979d0505ee0eecea7e4 Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Thu, 2 Dec 2010 12:47:50 -0500 Subject: [PATCH] minor: Collection#remove returns true on nonsafe remove --- lib/mongo/collection.rb | 1 + test/collection_test.rb | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/mongo/collection.rb b/lib/mongo/collection.rb index e17b177..e4a6392 100644 --- a/lib/mongo/collection.rb +++ b/lib/mongo/collection.rb @@ -321,6 +321,7 @@ module Mongo @connection.send_message_with_safe_check(Mongo::Constants::OP_DELETE, message, @db.name, nil, safe) else @connection.send_message(Mongo::Constants::OP_DELETE, message) + true end end diff --git a/test/collection_test.rb b/test/collection_test.rb index 56f6b3f..807c534 100644 --- a/test/collection_test.rb +++ b/test/collection_test.rb @@ -263,13 +263,12 @@ class TestCollection < Test::Unit::TestCase @db = @conn[MONGO_TEST_DB] @test = @db['test-safe-remove'] @test.save({:a => 50}) - @test.remove({}, :safe => true) + assert_equal 1, @test.remove({}, :safe => true)["n"] @test.drop end def test_remove_return_value - assert_equal 50, @@test.remove({}) - assert_equal 57, @@test.remove({"x" => 1}) + assert_equal true, @@test.remove({}) end def test_count