Hi, I am working with mongo aggregation in c# and I happen o face this below isue incase data set seems to be very huge to process on.
Command aggregate failed: PlanExecutor error during aggregation :: caused by :: document constructed by $facet is 104857760 bytes, which exceeds the limit of 104857600 bytes.
You can limit the data that is being projected using $project, $limit, $match , etc
Another way out is to allow the use of disk storage when performing aggregation operations by adding the following piece of code in your aggregation pipeline:
The size of the document produced by exceed the BSON size limit, I believe that
would not make any difference.
The problem with $facet is that it produce only 1 document. In another thread about $facet I came up with an hack that uses $unionWith rather than $facet to get the same answer but in a different format. May be you may adapt this solution to your problem.
You could also share your $facet and we could propose other alternatives.