MongoServerSelectionError: Server selection timed out after 2000 ms

I’m connecting to my mongo database from the server. When I connect I do a ‘ps’ from another window and see serverSelectionTimeoutMS=2000, but I’m not setting that.
How do I change the default? I thought it was 30 seconds.
I’m running version 7.0.5.
This causes a problem with our monitoring since it sometimes takes the 2 seconds to connect, fails, and we receive a message saying the database might be down on that node.