Recently I updated Node.js to version 20.3.1 and tried to connect my MongoDB Atlas. When my Node.js's version is 19.X, the connection of Atlas is normal. However, The terminal shows the deprecation warning in the Node.js 20.3.1:
[DEP0170] DeprecationWarning: The URL mongodb://:@ac-4hlp44x-shard-00-01.nqjamzn.mongodb.net:27017,ac-4hlp44x-shard-00-02.nqjamzn.mongodb.net:27017,ac-4hlp44x-shard-00-00.nqjamzn.mongodb.net:27017/?authSource=admin&replicaSet=atlas-g8a2vr-shard-0&retryWrites=true&w=majority&ssl=true is invalid. Future versions of Node.js will throw an error.
The original URL for connecting to Atlas is:
MONGODB_URI=mongodb+srv://<USERNAME>:<PASSWORD>@<USERNAME>.nqjamzn.mongodb.net/<DATABASE>?retryWrites=true&w=majority
The database is still connected.
I tried to search the related articles, but there's not any information about this deprecation.
How can I fix it?