Problem connecting to mongo

Try 127.0.0.1 instead of localhost
Also read about Ipv6 vs Ipv4 support

Nodejs 18 is not supporting to MongoDB 4.4.0.
Please let us know which version of MongoDB version will support. what are the changes required for upgrade NodeJS version 18