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 });