Hello Forest Admin Support Team,
I’m encountering significant performance issues when accessing the payments collection in my Forest Admin panel. Loading times can reach up to 2 minutes, which makes the UI practically unusable.
Environment
"@forestadmin/agent": "^1.64.5",
"@forestadmin/datasource-mongoose": "^1.8.9",
Captured Aggregation Command
{
"type": "command",
"ns": "DB.payments"
"command": {
"aggregate": "payments",
"pipeline": [
{ "$addFields": { /* dozens of nested fields flattened */ } },
{ "$addFields": { "riskEvaluation@@@decision": "$riskEvaluation.decision" } },
{ "$project": { /* exclude original nested paths */ } },
{
"$match": {
"$and": [
{
"status": {
"$eq": "REFUNDED"
}
},
{
"status": {
"$ne": "EXPIRED"
}
},
{
"status": {
"$ne": "OPEN"
}
},
{
"organizationId": {
"$ne": "xxx"
}
},
{
"organizationId": {
"$ne": "xxx"
}
},
{
"organizationId": {
"$ne": "xxx"
}
},
{
"organizationId": {
"$ne": "xxx"
}
},
{
"organizationId": {
"$ne": "xxx"
}
},
{
"organizationId": {
"$ne": "xxx"
}
}
]
}
},
{ "$sort": { "createdAt": -1 } },
{ "$skip": 0 },
{ "$limit": 100 },
{ "$project": { /* include only final fields */ } }
],
"cursor": {},
"$db": "DB"
},
"planSummary": "IXSCAN { status: -1 }",
"durationMillis": 11255
"keysExamined": 34095,
"docsExamined": 34095,
}
Observed Metrics
- keysExamined/docsExamined: ~34,000 each
- Bytes read: ~2.5 GB
- Duration: ~11 s per request, up to 2 min under load
- Records returned: 100 (limit)
Questions & Requested Assistance
- Are there known issues in versions 1.64.5 / 1.8.9 that could generate suboptimal aggregation pipelines?
- Could there be a misconfiguration of
flattenMode
ordatasource-mongoose
defaults causing full collection scans? - What diagnostic steps or logging should I enable to pinpoint pipeline inefficiencies?
- Is there any additional configuration or recommended index strategy to improve aggregate performance in Forest Admin?
Thank you for any guidance or troubleshooting steps you can provide. Please let me know if you need further details or logs.
—
Best regards,
Ilyas