mongodb/mongo-ruby-driver — pull request #256 by TylerBrock (2013-08-29 16:41:41+00:00)
Title: RUBY-660 allow aggregation helper to return cursors

Modeled very closely after the [python version](https://github.com/mongodb/mongo-python-driver/commit/1b455f226abd01c71e9429bd26ee3a2446909769).

Some notable differences are that we do not support `#distinct` being called on a cursor (it has to be called from a collection) so checking if the cursor represents a command is not necessary.

Aside: I thought it was more elegant to pass the pinned pool used for the initial batch into `Mongo::Cursor` from `Collection#aggregate` than to complicate the logic in Cursor. Without this, `Cursor#send_get_more` would need to select a pool when a cursor is seeded with an initial batch and cursor id.