MongoServerSelectionError: Server selection timed out after 30000

I am getting an “MongoServerSelectionError: Server selection timed out after 30000 ms” while running qry.

The MongoDB Node.js Driver will raise a MongoServerSelectionError typically when a timeout occurs during server selection.

Each driver operation requires choosing of a healthy server satisfying the server selection criteria. If an appropriate server cannot be found within the server selection timeout (which is controlled via serverSelectionTimeoutMS and defaults to 30000), the driver will raise a server selection timeout error.

Typically this error occurs when your client cannot connect to your cluster (ex: the application’s IP address is not in Atlas’ IP Access List), or if there is a network issue between the client and the server.

1 Like