Fetching all MongoDB records then filtering client-side causes 40x slowdown
warningperformanceUpdated Nov 4, 2024(via Exa)
Sources
How to detect:
MongoDB queries fetching all records (240+) then filtering in Python application code cause multi-second delays per request, contributing to overall page load degradation
Recommended action:
Push filtering to database using MongoDB query operators (end__gte for >=, basin__exists for field existence checks). Use .only() to limit returned fields. Replace Python for loops with database-native filtering. This achieves 40x speedup.