mongodb/mongo-ruby-driver — pull request #263 by estolfo (2013-09-19 00:12:57+00:00)
Title: RUBY-669 out aggregation pipeline operator

This pull request provides support for the new $out aggregation pipeline operator. It is new in version 2.6 of the server.

The $out pipeline option allows you to specify the name of a collection to which the result of the aggregation should be written.

The result of the aggregation returned to the user will be the raw result document from the server if $out is used.

There is an additional check on the read preference used with the aggregation. The only replica set member that can be used with $out is the primary. This is because the result set is written to a collection. If a read preference other than primary is specified, a MongoArgumentError is raised.