title: Error while trying to insert data from post request in MongoDB: MongooseError: Operation `posts.insertOne()` buffering timed out after 10000ms
body: <p>I am new in NodeJS. There is no error while connecting to mongodb</p>
  <p><strong>app.js</strong></p>
  <pre><code>const express = require('express');
  const app = express();
  const mongoose = require('mongoose');
  const bodyParser = require('body-parser');
  
  require('dotenv/config')
  
  app.use(bodyParser.json()); 
  const postsRoute = require('./routes/posts');
  app.use('/posts', postsRoute);
  
  
  app.get('/',(req, res)=&gt;{
      res.send(&quot;Hello&quot;);
  });
  
  //connect to db 
  mongoose.connect(process.env.DB_CONNECT,{ useNewUrlParser: true },()=&gt;{
      console.log(&quot;connected to db&quot;);
  });
  
  app.listen(3000);
  </code></pre>
  <p><strong>post.js</strong></p>
  <pre><code>const express = require('express');
  const Post = require('../models/Post');
  const router = express.Router();
  
  router.get('/',(req, res)=&gt;{
      res.send('we are on posts');
  });
  router.post('/',(req, res)=&gt;{
      const post = new Post({
          title: req.body.title,
          description: req.body.description
      });
      
      post.save()
      .then(data =&gt;{
          res.json(data);
      })
      .catch(err =&gt;{
          console.log(err)
      }); 
  });
  
  module.exports = router;
  </code></pre>
  <p><strong>in console:</strong></p>
  <p>connected to db</p>
  <p>MongooseError: Operation <code>posts.insertOne()</code> buffering timed out after 10000ms
  at Timeout. (D:\projects\PracticeNode\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:197:23)</p>