The amount of processing that can occur in the aggregation structure depends on your design.
The aggregation structure can only display the relative indicator of one document at the moment (for more, you want to see: https://jira.mongodb.org/browse/SERVER-3253 ) and it will be displayed in the form:
{ result: {
So, you must make sure that what you return from your $group / $project is not so large that you will not get the desired results. In most cases, this is not so, and a simple $group even for millions of lines can lead to a response of less than 16 megabytes.
We have no idea about the size of your documents or about the aggregate requests that you want to run, so we cannot report this.
If any aggregation operation consumes more than 10 percent of system RAM, the operation will result in an error.
This is really understandable. If the working set for the operation is so large that it takes up more than 10 percent of RAM ( $group / Calculated fields / $sort in calculated or grouped fields), then this will not work.
Unless you try to misuse the aggregation structure for your application logic, you will never run into this problem.
Currently, the aggregation system stores operations in the $ group, which can cause problems when processing more groups.
Since $group really hard not to execute in memory (it βgroupsβ the field), this means that operations with this group are also in memory, i.e. $sort here you can start using up to 10% if you are not careful.
Sammaye
source share