title: Can't connect to mongo db on a debian VM from Windows host
body: <p>I am doing doing a project where I have a mongo database on a debian VM 9.8.0 (with last virtualbox version).
  I have a nodejs app on my computer (Windows 10) and I want to connect this application to my mongo database. 
  I tried a lot of things but still get the same error : 
  Error : connect ECONNREFUSED :217017</p>
  
  <ul>
  <li>I tried to disable firewall on my computer and on the VM</li>
  <li>I tried all VM network conf possible (currently on private host network)</li>
  <li>I can ping my VM from my computer and from my computer to the VM</li>
  <li>The application is working with a mongo database in local</li>
  <li>Probably a bad config somewhere, the code seems correct</li>
  <li>The mongod service is running with the command : sudo service mongod start</li>
  <li>I can see that mongod is in LISTENING state by using lsof -i</li>
  </ul>
  
  <p>nodejs server : (launched with "node server.js" command)</p>
  
  <pre><code>var fs = require('fs');
  var url = require('url');
  var querystring = require('querystring');
  
  var express = require('express');
  var app = express();
  
  //****** MONGODB *******/
  const MongoClient = require('mongodb').MongoClient;
  const assert = require('assert');
  
  // Connection URL
  const urlMongo = 'mongodb://192.168.56.101:27017';
  
  // Database Name
  const dbName = 'projet';
  
  // Create a new MongoClient
  const client = new MongoClient(urlMongo);
  </code></pre>
  
  <p>error :</p>
  
  <pre class="lang-sh prettyprint-override"><code>AssertionError [ERR_ASSERTION]: { Error: connect ECONNREFUSED 192.168.56.101:27017
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
    errn... == null
      at D:\Basile\Master Informatique\BDD\Projet\server.js:134:20
      at err (D:\Basile\Master Informatique\BDD\Projet\node_modules\mongodb\lib\utils.js:411:14)
      at executeCallback (D:\Basile\Master Informatique\BDD\Projet\node_modules\mongodb\lib\utils.js:401:25)
      at err (D:\Basile\Master Informatique\BDD\Projet\node_modules\mongodb\lib\operations\mongo_client_ops.js:285:21)
      at connectCallback (D:\Basile\Master Informatique\BDD\Projet\node_modules\mongodb\lib\operations\mongo_client_ops.js:265:5)
      at server.connect (D:\Basile\Master Informatique\BDD\Projet\node_modules\mongodb\lib\operations\mongo_client_ops.js:353:14)
      at Server.&lt;anonymous&gt; (D:\Basile\Master Informatique\BDD\Projet\node_modules\mongodb\lib\topologies\server.js:237:11)
      at Object.onceWrapper (events.js:277:13)
      at Server.emit (events.js:189:13)
      at Pool.&lt;anonymous&gt; (D:\Basile\Master Informatique\BDD\Projet\node_modules\mongodb-core\lib\topologies\server.js:452:12)
  </code></pre>
  
  <p>Since the application is running with a local mongo db, I do not understand why it is not running well with my VM.</p>