A server-side configuration, defaultMaxTimeMS, was added in MongoDB 8.0. See the docs at https://www.mongodb.com/docs/manual/reference/cluster-parameters/defaultMaxTimeMS
defaultMaxTimeMS