title: Error: mongoose.model is not a function
body: <p>I'm following along in a few different MEAN tutorials, and I'm getting hung up on something that none of the tutorials seem to encounter. I'm getting the following error:</p>
  
  <pre><code>Uncaught TypeError: mongoose.model is not a function
  </code></pre>
  
  <p>I tried deleting node_modules and reinstalling everything, and that didn't help. What am I missing? I'm using Webpack to load my modules. Could that have anything to do with this issue?</p>
  
  <p>Here's my model:</p>
  
  <p><strong>./app/authentication/user.model.js</strong></p>
  
  <pre><code>'use strict';
  
  var mongoose = require('mongoose');
  
  var UserSchema = new mongoose.Schema({
      firstName: String,
      lastName: String,
      email: String,
      password: String
  });
  
  mongoose.model('User', UserSchema);
  </code></pre>
  
  <p>and the following mongoose config file:</p>
  
  <p><strong>./server/config/mongoose.js</strong></p>
  
  <pre><code>'use strict';
  
  var config = require('./environment');
  var mongoose = require('mongoose');
  
  module.exports = function() {
      var db = mongoose.connect(config.db);
  
      mongoose.connection.on('error', function(err) {
          console.error('MongoDB connection error: ' + err);
          process.exit(-1);
      });
  
      require('../../app/authentication/user.model');
  
      return db;
  };
  </code></pre>