Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated options on Mongodb Drivers #646

Open
kelwinxd opened this issue Nov 18, 2023 · 0 comments
Open

Deprecated options on Mongodb Drivers #646

kelwinxd opened this issue Nov 18, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@kelwinxd
Copy link

kelwinxd commented Nov 18, 2023

When i try no connect to Atlas Mongodb, the connection was succesful. Although, the following message appeared on terminal:

**

error in authentication man! [Function: error]
(node:9712) [MONGODB DRIVER] Warning: useNewUrlParser is a deprecated option: useNewUrlParser 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:9712) [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**

The connection coding:
`const { error } = require('console');
const { MongoClient } = require('mongodb');

const uri = "mongodb+srv://kelwinesechiel8:@cluster0.vxfjhgw.mongodb.net/?retryWrites=true&w=majority";

async function run() {
const client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true });

try {
await client.connect();

const dbo = client.db('keldb');
const obj = { name:'Kaleb' };
const colecao = 'names';

await dbo.collection(colecao).insertOne(obj);
console.log('succesfully inserted');

} finally {
await client.close();
}
}

run().catch(console.log('error in authentication man!', error));
`

Config:
Node 20.8.1
Mongodb ^6.3.0

@kelwinxd kelwinxd added the bug Something isn't working label Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant