2 / 19
Nov 2023
[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.
12 days later
12 days later
12 days later

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 }, }) );
9 days later

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.

15 days later

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

3 months later

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
};

17 days later

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)

3 months later
13 days later
7 months later