mongodb/mongo-ruby-driver — pull request #220 by estolfo (2013-07-08 22:28:20+00:00)
Title: RUBY-636 Initial fluent interface implementation: Scope for defining a query with options

This is an initial implementation of the fluent interface for doing a find with options. A separate pull request will be made for additional CRUD operations.

## Scope
A Scope object is created and returned by the find method on Collection. The user can specify a selector and options for the query that are set on the Scope object at initialization.

The options and selector can be modified by calling methods on the Scope object. The methods called with an argument will modify that option. The methods called without an argument will return the value for that option.

## Terminators
The Scope object can be modified without limit until a _terminator_ is called. A _terminator_ is a method such as #each or #to_a that will create a Cursor and execute the query on the server. #count and #explain are also terminators.
The terminators will be added to Scope in a separate pull request.

## Examples
collection.find() # returns a Scope object
collection.find({:name => "Emily"}).limit(5) # returns a Scope object
collection.find({:name => "Emily"}).to_a # creates a Cursor and sends the query to the server, returns a result set

## Tests
Specs have been submitted in this pull request for the find functionality of a Scope. As mentioned above, a separate pull request will be made with additional CRUD operations and specs.