My use case for output of the aggregation query:
[{
items: <ALL_DOCUMENTS>,
count: <ALL_DOCUMENTS_LENGTH>
}]
I did a try with `$facet`:
db.collection(<COLLECTION>).aggregate([
{ $facet: { items: [{ $match: <FILTER> }] } },
{
$project: {
items: { $slice: ['$items', <SKIP>, <LIMIT>] },
count: { $size: '$items' }
}
}
])
but I got the error:
PlanExecutor error during aggregation :: caused by :: document constructed by $facet is 1049500 bytes, which exceeds the limit of 104857600 bytes
What should I use to set `items` equals to result of `$match` result avoiding `$facet`?