Open khelan-mehta opened 1 year ago
this error means that in latest version of mongo db there is no need of a callback function
On Tue, Sep 5, 2023 at 5:01 PM Khelan Mehta @.***> wrote:
const connectToMongo = ()=>{ try{ mongoose.connect(mongoURI) console.log("SUCCESSFULLY CONNECTED DB"); }catch(error){ console.log(error); }
}
— Reply to this email directly, view it on GitHub https://github.com/CodeWithHarry/iNotebook-React/issues/64, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZIEULYNPOTLER4O4BWSJE3XY4EQ3ANCNFSM6AAAAAA4LUHA4Y . You are receiving this because you are subscribed to this thread.Message ID: @.***>
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;`