diff --git a/lib/mongo/collection.rb b/lib/mongo/collection.rb index 05a89a8..c96c41a 100644 --- a/lib/mongo/collection.rb +++ b/lib/mongo/collection.rb @@ -462,19 +462,9 @@ module Mongo # @param [String, BSON::Code] finalize :: optional. a JavaScript function that receives and modifies # each of the resultant grouped objects. Available only when group is run # with command set to true. - # @param [Nil] deprecated this param in a placeholder for a deprecated param. It will be removed - # in the next release. # # @return [Array] the grouped items. - def group(key, condition, initial, reduce, finalize=nil, deprecated=nil) - - # Warn of changed API post eval deprecation. - if finalize == true || finalize == false || deprecated - warn "The API for Collection#group has changed. 'Finalize' is now the fifth parameter, " + - "since it's no longer necessary to specify whether #group is run as a command. " + - "See http://api.mongodb.org/ruby/current/Mongo/Collection.html#group-instance_method for details." - end - + def group(key, condition, initial, reduce, finalize=nil) reduce = BSON::Code.new(reduce) unless reduce.is_a?(BSON::Code) group_command = { @@ -499,9 +489,6 @@ module Mongo group_command["group"][key_type] = key_value end - # only add finalize if specified - # check to see if users have sent the finalizer as the last argument. - finalize = deprecated if deprecated.is_a?(String) || deprecated.is_a?(BSON::Code) finalize = BSON::Code.new(finalize) if finalize.is_a?(String) if finalize.is_a?(BSON::Code) group_command['group']['finalize'] = finalize diff --git a/test/db_api_test.rb b/test/db_api_test.rb index bdbb6ed..add7156 100644 --- a/test/db_api_test.rb +++ b/test/db_api_test.rb @@ -545,7 +545,7 @@ class DBAPITest < Test::Unit::TestCase assert_equal 1, test.group([], {"a" => {"$gt" => 1}}, {"count" => 0}, "function (obj, prev) { prev.count++; }")[0]["count"] finalize = "function (obj) { obj.f = obj.count - 1; }" - assert_equal 2, test.group([], {}, {"count" => 0}, "function (obj, prev) { prev.count++; }", true, finalize)[0]["f"] + assert_equal 2, test.group([], {}, {"count" => 0}, "function (obj, prev) { prev.count++; }", finalize)[0]["f"] test.insert("a" => 2, "b" => 3) expected = [{"a" => 2, "count" => 2},