Modern mongodb drivers use unified topology which automatically detects if a replica set is in use. Try using the 'diectConnection' option: https://www.mongodb.com/docs/manual/reference/connection-string-options/#mongodb-urioption-urioption.directConnection