title: require not working if not using destructuring assignment
body: <p>In my <code>nodejs</code>, I have a small <code>mongoose</code> module which <code>exports</code> the <code>model (User)</code>. When I require the module without using <code>destructuring</code> assignment and I create the new instance of the model using <code>new</code> operator, I get the <code>error</code> that the model is not a function. But if i use the <code>destructuring</code> assignment when I <code>require</code> the model, everything works fine. Not able to understand why. </p>
  
  <p><strong>User.js</strong> exports the <strong>model</strong></p>
  
  <pre><code>const mongoose = require('mongoose');
  
  exports.User = mongoose.model('User', {
      email:{
          type: String,
          trim: true,
          minlength: 1,
          reuqired: true
      }
  });
  </code></pre>
  
  <p>Below code throws error if I dont use destructuring operator on <strong>line 2</strong>:<br>
  <strong>server.js</strong></p>
  
  <pre><code>const mongoose = require('../DB/mongoose');
  const User = require('../Models/User');
  
  console.log(typeof(User));
  
  let user = new User({
      email: "sdfdsf"
  });
  </code></pre>
  
  <p><strong>server.js</strong> throws the below error:  </p>
  
  <pre><code>let user = new User({
             ^
  
  TypeError: User is not a constructor
      at Object.&lt;anonymous&gt; (F:\javascript\nodePractice\ToDoApp\server\server.js:6:12)
      at Module._compile (internal/modules/cjs/loader.js:678:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
      at Module.load (internal/modules/cjs/loader.js:589:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
      at Function.Module._load (internal/modules/cjs/loader.js:520:3)
      at Function.Module.runMain (internal/modules/cjs/loader.js:719:10)
      at startup (internal/bootstrap/node.js:228:19)
      at bootstrapNodeJSCore (internal/bootstrap/node.js:576:3)
  </code></pre>
  
  <blockquote>
    <p>But If I use a <code>destructuring</code> assignment on <code>line 2</code>, it works all fine.
    <strong>server.js</strong>: </p>
  </blockquote>
  
  <pre><code>const mongoose = require('../DB/mongoose');
  const {User} = require('../Models/User');
  
  console.log(typeof(User));
  
  let user = new User({
      email: "sdfdsf"
  });
  </code></pre>