title: How to solve Mongoose v5.11.0 model.find() error: Operation `products.find()` buffering timed out after 10000ms"
body: <p>How to solve model.find() function produces &quot;buffering timed out after ... ms&quot;? I'm using mongoose v 5.11.0, npm v6.14.8 and mongodb v</p>
  <p>Here's the code.</p>
  <pre><code>var express = require('express');
  var app = express();
  var bodyParser = require('body-parser');
  const assert = require('assert');
  
  var mongoose = require('mongoose');
  
  try {
      var db = mongoose.connect('mongodb://localhost:27017', {useNewUrlParser: true, dbName: 'swag-shop' });
      console.log('success connection');
  }
  catch (error) {
      console.log('Error connection: ' + error);
  }
  
  
  var Product = require('./model/product');
  var WishList = require('./model/wishlist');
  
  //Allow all requests from all domains &amp; localhost
  app.all('/*', function(req, res, next) {
    res.header(&quot;Access-Control-Allow-Origin&quot;, &quot;*&quot;);
    res.header(&quot;Access-Control-Allow-Headers&quot;, &quot;X-Requested-With, Content-Type, Accept&quot;);
    res.header(&quot;Access-Control-Allow-Methods&quot;, &quot;POST, GET&quot;);
    next();
  });
  
  app.get('/product', function(request, response) {
  
      Product.find({},function(err, products) {
          if (err) {
              response.status(500).send({error: &quot;Could not fetch products. &quot;+ err});
          } else {
              response.send(products);
          }
      });
  });
  
  app.listen(3004, function() {
      console.log(&quot;Swag Shop API running on port 3004...&quot;);
  });
  </code></pre>
  <p>The product model:</p>
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  
  var product = new Schema({
      title: String,
      price: Number,
      likes: {type: Number, default: 0}
  });
  
  module.exports = mongoose.model('Product', product);
  </code></pre>
  <p>Additionally, running the file also produces the following warnings:</p>
  <pre><code>D:\Test\swag-shop-api&gt;nodemon server.js
  [nodemon] 2.0.6
  [nodemon] to restart at any time, enter `rs`
  [nodemon] watching path(s): *.*
  [nodemon] watching extensions: js,mjs,json
  [nodemon] starting `node server.js`
  success connection
  Swag Shop API running on port 3004...
  (node:28596) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The &quot;url&quot; argument must be of type string. Received type function ([Function (anonymous)])
      at validateString (internal/validators.js:122:11)
      at Url.parse (url.js:159:3)
      at Object.urlParse [as parse] (url.js:154:13)
      at module.exports (D:\Test\swag-shop-api\node_modules\mongoose\node_modules\mongodb\lib\url_parser.js:15:23)
      at connect (D:\Test\swag-shop-api\node_modules\mongoose\node_modules\mongodb\lib\mongo_client.js:403:16)
      at D:\Test\swag-shop-api\node_modules\mongoose\node_modules\mongodb\lib\mongo_client.js:217:7
      at new Promise (&lt;anonymous&gt;)
      at MongoClient.connect (D:\Test\swag-shop-api\node_modules\mongoose\node_modules\mongodb\lib\mongo_client.js:213:12)
      at D:\Test\swag-shop-api\node_modules\mongoose\lib\connection.js:820:12
      at new Promise (&lt;anonymous&gt;)
      at NativeConnection.Connection.openUri (D:\Test\swag-shop-api\node_modules\mongoose\lib\connection.js:817:19)
      at D:\Test\swag-shop-api\node_modules\mongoose\lib\index.js:345:10
      at D:\Test\swag-shop-api\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:5
      at new Promise (&lt;anonymous&gt;)
      at promiseOrCallback (D:\Test\swag-shop-api\node_modules\mongoose\lib\helpers\promiseOrCallback.js:30:10)
      at Mongoose._promiseOrCallback (D:\Test\swag-shop-api\node_modules\mongoose\lib\index.js:1135:10)
  (Use `node --trace-warnings ...` to show where the warning was created)
  (node:28596) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
  (node:28596) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  </code></pre>
  <p>I tried increasing the <strong>bufferTimeoutMS</strong> or disabling the <strong>bufferCommands</strong> but still it won't work.</p>