Error in Agrregation in c#

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.

can anyone help me with this ?

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:

db.collection.aggregate([
    { $facet: { /* your facet stages */ } }
], { allowDiskUse: true });

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.

@24607815c24a436018de450a60b0dda, please follow up on your thread.

Have you tried the my

Have you tried to

or

You got 3 avenues to follow. Please share any issues you got while trying them all. If everything proposed failed please