Note there was a bug in Node 18 around the TCP autoSelectFamily option that was later fixed but could become problematic in the driver. You can get around this by passing a family: 4 or family: 6 option to the MongoClient or try upgrading to Node 20+.