Solved : MongooseError: Operation `files.insertOne()` buffering timed out after 10000ms

Error : while connecting or inserting Data in MongoDB atlas


Guys i have found a error when connecting to MongoDB atlas cloud. when i'm connecting to mongodb than my code is blow :
 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

Popular posts from this blog

how to get 1,000 rupya by Bihar government immediately || in Hindi||covid19

How to get 1000 rupya by Bihar VIP party in Hindi

10th class scholarship10 बिहार के छात्रों के लिए