Skip to content

Conversation

subrotoinlondon
Copy link

No description provided.

@@ -7,7 +7,7 @@ async function run() {
// a valid username and password! Note that in a production environment,
// you do not want to store your password in plain-text here.
const uri =
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const { MongoClient, ServerApiVersion } = require('mongodb');
const uri = "mongodb+srv://izzaddinid_db_user:[email protected]/?retryWrites=true&w=majority&appName=Cluster0";

// Create a MongoClient with a MongoClientOptions object to set the Stable API version
const client = new MongoClient(uri, {
serverApi: {
version: ServerApiVersion.v1,
strict: true,
deprecationErrors: true,
}
});

async function run() {
try {
// Connect the client to the server (optional starting in v4.7)
await client.connect();
// Send a ping to confirm a successful connection
await client.db("admin").command({ ping: 1 });
console.log("Pinged your deployment. You successfully connected to MongoDB!");
} finally {
// Ensures that the client will close when you finish/error
await client.close();
}
}
run().catch(console.dir);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants