In this chapter you got a look at the query
and options
objects that Collection
methods use to access documents in a database. The query
object allows you to limit which documents are considered for operations. The options
object allows you to control the interaction of the requests to limit the number of documents returned, which document to start on, and what fields to return.
The distinct()
, group()
, and aggregate()
methods allow you to group documents based on field values. The MongoDB aggregation framework allows you to process documents on a server before returning them to a client. The aggregation framework allows you to pipe documents from one aggregation operation to the next, each time mapping and reducing to a more defined set of data.