Hi all,
I’ve run into an issue and I’m not sure how to best approach finding a solution.
I’m using MongoDB 5.3.1 Community and MongoDB Compass. I have a database that contains a collection of “Dealers”. Each dealer record contains information about a customer and a list of vehicles they have in stock. In turn, each Vehicle record contains information about the vehicle and 2 arrays, one of associated images and the other about the vehicles specifications.
We are not talking large amounts of data. The Dealer collection only contains 57 records, and the largest number of vehicles is 113 records.
I’ve created an aggregate that:
- first matches the required dealer id.
- unwinds the Vehicles records.
- and this is where it bombs. I’m trying to create a facet stage, but I’m getting this error:
PlanExecutor error during aggregation :: caused by :: document constructed by $facet is 104910678 bytes, which exceeds the limit of 104857600 bytes
The aggregate is literally this:
[
{
'$match': {
'Id': 321 // Note this is not a Mongo _id but a distinct ID from a legacy system.
}
}, {
'$unwind': {
'path': '$Vehicles'
}
}, {
'$facet': {
'test': []
}
}
]
I don’t do anything in the facet stage and it still bombs.
I’ve not played with the allowDiskUse, because I wasn’t sure it should be throwing this sort of error, with this amount of data. I could be wrong.
If I turn off the facet stage and export the aggregate result, the output Json file is only 3.12MB.
Any advice would be greatly received. Tips on how to trouble shoot, possible reasons, what to do next.
Thanks in advance.