Solved : MongooseError: Operation `files.insertOne()` buffering timed out after 10000ms
Error : while connecting or inserting Data in MongoDB atlas
async function connectDB(){try{await mongoose.connect(process.env.dbUrl,() => console.log(" Mongoose is connected"),);}catch(e){console.log(e)
When we use above code than that is display : Mongoose is connected .
but, when i want to insert document to mongoDB atlas cloud than showing a error like this : const err = new MongooseError(message);
^
MongooseError: Operation `files.insertOne()` buffering timed out after 10000ms
at Timeout.<anonymous> (D:\expressJsBySujeet\fileShareBackend\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:151:23)if you want to don't see Like that error than use this two code :
useNewUrlParser: true,
useUnifiedTopology: true
when you 're making connection .
like this :
async function connectDB(){
try{
await mongoose.connect(process.env.dbUrl,{
useNewUrlParser: true,
useUnifiedTopology: true
},() => console.log(" Mongoose is connected"),
);
}catch(e){
console.log(e)
}
}
After that every thing will fine .
Comments
Post a Comment