I have a script that periodically runs aggregation in the mongodb collection. As the data set grows, the time spent on aggregation increases. My script aggregation recently stopped working sequentially, and the error logs show: error: { [MongoError: server <x> timed out] name: 'MongoError', message: 'server <x> timed out' } I tried to debug this, and the only one the pattern I can find is that this timeout seems to occur only when the aggregation takes more than 2 minutes (turnaround time about 2 m). Anyone have any further debugging tips? The 2 minute thing gives me the impression that I just need to set some kind of timeout somewhere, but I can't figure out where or if I just fall into a trap with a red herring.
About the system configuration: this is an aggregation script - this is the node.js application (v5.9.1) running in the docker container (v1.9.1) in the Alpine language. It uses the mongodb node driver (v2.1.19). One mongodb server (although this also happens in a separate environment using replSet) working with mongod (v3.2.6)
source share