Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
uri change
  • Loading branch information
Arifshariar7 committed Oct 2, 2021
1 parent 0413ea5 commit 3b791eb
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions utils/db.js
@@ -1,19 +1,21 @@
import mongoose from "mongoose";

let isConnected = false;
// const uri = "mongodb+srv://Arif:<password>@cluster0.3tw6k.mongodb.net/myFirstDatabase?retryWrites=true&w=majority";
const localUri="mongodb://localhost/paste-buckets"
const uri = "mongodb+srv://Arif:6d4xHrDVMb7BrteV@cluster0.3tw6k.mongodb.net/Arif?retryWrites=true&w=majority";
const localuri="mongodb://localhost/paste-buckets"

export const connect = async () => {
if (!isConnected) {
await mongoose.connect(
localUri,
{
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true,
}
);
await mongoose.connect(localuri, {

useNewUrlParser: true,

useUnifiedTopology: true

}, err => {
if(err) throw err;
console.log('Connected to MongoDB!!!')
});
isConnected = true;
}
};
};

0 comments on commit 3b791eb

Please sign in to comment.