[DEP0170] DeprecationWarning: The URL mongodb://<USERNAME>:<PASSWORD>@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/<DATABASE>?authSource=admin&replicaSet=atlas-g8a2vr-shard-0&retryWrites=true&w=majority&ssl=true is invalid. Future versions of Node.js will throw an error.
Hey have you fixed this problem? Currently I am facing the similar problem
Hi I think I read something related Receive DEP0170 when connecting MongoDB Atlas with Node.js 20.3.1 - Stack Overflow, I think theyâre saying itâs because of the numerous :
, making node thinking itâs port numbers.
Facing the same issue,is there any solution for this?
I have the same issue!
I keep getting the same erro while trying to deploy my node js project on render.com
Which version of the Node.js Driver are you using? Ignore this, we found the info we needed (see below)
Note that after a bit of digging weâve filed NODE-5802 for this issue. For anyone watching this thread the issue only affects 3.x of the driver (and any version of Mongoose that pins a 3.x version of the driver).
Upgrading to 4.x+ will address this warning.
Never mind. I was using a mongodb driver of version 2.x. I upgraded to 3.x and the issue was resolved. Thanks for the response.
I encountered the same issue and resolved it it this way :
I uninstalled the mongoose and mongodb packages.
Afterward, I installed the latest version of mongoose using this command:
npm install mongoose@latest
Upon encountering this error:
âconnection error: MongoParseError: options usecreateindex, usefindandmodify are not supported at parseOptionsâ.
I updated my mongoose connection method. Now, it looks like this:
mongoose.connect(dbUrl);
As a result, everything is now working well.
I wanted to add to the discussion for those who came to this thread after searching for a solution. I made the above updates to âmongooseâ and was still getting the error message.
I forgot that I was also connecting using a MongoDB transport for Winston.
If you are using âwinston-mongodbâ donât forget to add options:
winston.add(
new winston.transports.MongoDB({
db: 'mongodb://localhost/vidly',
level: 'error',
options: { useUnifiedTopology: true },
})
);
I have a similar situation to yours:
winston.add(
new winston.transports.MongoDB({
level: 'info',
db: process.env.DATABASE,
collection: 'info_logs',
options: {
useUnifiedTopology: true,
},
})
);
But I had the error:
[DEP0170] DeprecationWarning: The URL mongodb://<USERNAME>:<PASSWORD>@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/<DATABASE>?authSource=admin&replicaSet=atlas-g8a2vr-shard-0&retryWrites=true&w=majority&ssl=true is invalid. Future versions of Node.js will throw an error.
Update to latest for Winston, MongoDb, Mongoose. Then run ânpm ciâ , this cleared everything up for me.
i had the same problem this is caused by old version of mongoose
just update mongoose and it well be solved
npm install mongoose@latest
Had the same error when connecting loopback 4
Below is my configuration
const config = {
name: âmydatasourceâ,
connector: âmongodbâ,
url: âmongodb+srv://username********@developing.cpd3inw.mongodb.net/todosâ,
host: ââ',
port: ââ,
user: ââ,
password: ââ,
database: âtestdbâ,
useNewUrlParser: true
};
Hi everyone!
To solve this issue, first install the latest version of mongo by running: npm i mongo@latest
Then, remove the options passed to the MongoClient connect.
` const connection = await MongoClient.connect(mongoDBURL)````
(node:18412) [MONGODB DRIVER] Warning: useUnifiedTopology is a deprecated option: useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version
(Use node --trace-warnings ...
to show where the warning was created)
node : 20.16.0
npm : 10.8.1
mongoose : 8.5.2
Error Msg
(node:88445) [DEP0170] DeprecationWarning: The URL mongodb://user:pass@bycdigital-shard-00-00.9cgp0.mongodb.net:27017,bycdigital-shard-00-02.9cgp0.mongodb.net:27017,bycdigital-shard-00-01.9cgp0.mongodb.net:27017/?authSource=admin&replicaSet=atlas-9xtpry-shard-0&retryWrites=true&w=majority&appName=BYCDigital&ssl=true is invalid. Future versions of Node.js will throw an error.
How can solve it ?
did you install the mongodb driver ?
npm i mongodb