diff --git a/CREDITS b/CREDITS new file mode 100644 index 0000000..afa28b2 --- /dev/null +++ b/CREDITS @@ -0,0 +1,60 @@ +Adrian Madrid, aemadrid@gmail.com +* bin/mongo_console +* examples/benchmarks.rb +* examples/irb.rb +* Modifications to examples/simple.rb +* Found plenty of bugs and missing features. +* Ruby 1.9 support. +* Gem support. +* Many other code suggestions and improvements. + +Aman Gupta, aman@tmm1.net +* Collection#save + +Jon Crosby, jon@joncrosby.me +* Some code clean-up + +John Nunemaker, http://railstips.org +* Collection#create_index takes symbols as well as strings +* Fix for Collection#save +* Add logger convenience methods to connection and database + +David James, djames@sunlightfoundation.com +* Fix dates to return as UTC + +Paul Dlug, paul.dlug@gmail.com +* Generate _id on the client side if not provided +* Collection#insert and Collection#save return _id + +Durran Jordan, durran@gmail.com +* DB#collections +* Support for specifying sort order as array of [key, direction] pairs + +Cyril Mougel, cyril.mougel@gmail.com +* Initial logging support +* Test case + +Jack Chen, chendo on github +* Test case + fix for deserializing pre-epoch Time instances + +Michael Bernstein, mrb on github +* #sort method for Cursor instances + +Paulo Ahahgon, pahagon on github +* removed hard limit + +Les Hill, leshill on github +* OrderedHash#each returns self + +Sean Cribbs, seancribbs on github +* Modify standard_benchmark to allow profiling + +Sunny Hirai +* Suggested hashcode fix for Mongo::ObjectID +* Noted index ordering bug. + +Christos Trochalakis +* Added map/reduce helper + +Blythe Dunham +* Added finalize option to map/reduce diff --git a/README.rdoc b/README.rdoc index 3b7c267..669bafa 100644 --- a/README.rdoc +++ b/README.rdoc @@ -329,63 +329,7 @@ See HISTORY. = Credits -Adrian Madrid, aemadrid@gmail.com -* bin/mongo_console -* examples/benchmarks.rb -* examples/irb.rb -* Modifications to examples/simple.rb -* Found plenty of bugs and missing features. -* Ruby 1.9 support. -* Gem support. -* Many other code suggestions and improvements. - -Aman Gupta, aman@tmm1.net -* Collection#save - -Jon Crosby, jon@joncrosby.me -* Some code clean-up - -John Nunemaker, http://railstips.org -* Collection#create_index takes symbols as well as strings -* Fix for Collection#save -* Add logger convenience methods to connection and database - -David James, djames@sunlightfoundation.com -* Fix dates to return as UTC - -Paul Dlug, paul.dlug@gmail.com -* Generate _id on the client side if not provided -* Collection#insert and Collection#save return _id - -Durran Jordan, durran@gmail.com -* DB#collections -* Support for specifying sort order as array of [key, direction] pairs - -Cyril Mougel, cyril.mougel@gmail.com -* Initial logging support -* Test case - -Jack Chen, chendo on github -* Test case + fix for deserializing pre-epoch Time instances - -Michael Bernstein, mrb on github -* #sort method for Cursor instances - -Paulo Ahahgon, pahagon on github -* removed hard limit - -Les Hill, leshill on github -* OrderedHash#each returns self - -Sean Cribbs, seancribbs on github -* Modify standard_benchmark to allow profiling - -Sunny Hirai -* Suggested hashcode fix for Mongo::ObjectID -* Noted index ordering bug. - -Christos Trochalakis -* Added map/reduce helper +See CREDITS = License diff --git a/lib/mongo/collection.rb b/lib/mongo/collection.rb index b0f62d7..84b2f81 100644 --- a/lib/mongo/collection.rb +++ b/lib/mongo/collection.rb @@ -338,11 +338,14 @@ module Mongo # Performs a group query, similar to the 'SQL GROUP BY' operation. # Returns an array of grouped items. # - # :keys :: Array of fields to group by + # :keys :: an array of fields to group by # :condition :: specification of rows to be considered (as a 'find' # query specification) # :initial :: initial value of the aggregation counter object # :reduce :: aggregation function as a JavaScript string + # :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. # :command :: if true, run the group as a command instead of in an # eval - it is likely that this option will eventually be # deprecated and all groups will be run as commands @@ -381,7 +384,8 @@ module Mongo end end - raise OperationFailure, "finalize is only supported with the group command" if finalize + raise OperationFailure, ":finalize can be specified only when " + + "group is run as a command (set command param to true)" if finalize case reduce when Code