Navigation
This version of the documentation is archived and no longer supported.

Aggregation Pipeline Limits

Aggregation operations with the aggregate command have the following limitations.

Type Restrictions

The aggregation pipeline cannot operate on values of the following types: Symbol, MinKey, MaxKey, DBRef, Code, and CodeWScope.

Changed in version 2.4: Removed restriction on Binary type data. In MongoDB 2.2, the pipeline could not operate on Binary type data.

Result Size Restrictions

Output from the pipeline cannot exceed the BSON Document Size limit, which is currently 16 megabytes. If the result set exceeds this limit, the aggregate command produces an error.

Memory Restrictions

If any single aggregation operation consumes more than 10 percent of system RAM, the operation will produce an error.

Cumulative operators, such as $sort and $group, require access to the entire input set before they can produce any output. These operators log a warning if the cumulative operator consumes 5% or more of the physical memory on the host. Like any aggregation operation, these operators produce an error if they consume 10% or more of the physical memory on the host. See the $sort and $group reference pages for details on their specific memory requirements and use.