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

In db.js MONGODB no longer wants a callback function, Go for this #64

Open
khelan-mehta opened this issue Sep 5, 2023 · 2 comments
Open

Comments

@khelan-mehta
Copy link

const connectToMongo = ()=>{
    try{
        mongoose.connect(mongoURI)
        console.log("SUCCESSFULLY CONNECTED DB");
    }catch(error){
        console.log(error);
    }
    
}
@PrakharDsek
Copy link

PrakharDsek commented Sep 6, 2023 via email

@Prathamesh01110
Copy link

This will Resolve Your Issuse `const mongoose = require('mongoose');

const connectToMongo = async ()=>{
try{
mongoose.set('strictQuery',false)
await mongoose.connect("mongodb://localhost:27017")
console.log('Mongo connected')
}catch(error){
console.log(error)
process.exit()
}
}

module.exports = connectToMongo;`

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

No branches or pull requests

3 participants