title: mongoose TypeError: Schema is not a constructor
body: <p>I've encountered a strange thing. I have several mongoose models - and in one of them (only in one!) I get this error:</p>
  
  <pre><code>TypeError: Schema is not a constructor
  </code></pre>
  
  <p>I find it very strange as I have several working schemas. I tried logging <code>mongoose.Schema</code> in the non-working schema and it is indeed different from the mongoose.Schema in my working schemas - how is that possible? The code is almost identical.
  Here's the code for the non-working schema:</p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  
  var errSchema = new Schema({
    name: String,
    images:[{
      type:String
    }],
    sizes:[{
      type: String
    }],
    colors:[{
      type: Schema.ObjectId,
      ref: 'Color'
    }],
    frontColors:[{
      type: Schema.ObjectId,
      ref: 'Color'
    }],
    script: Boolean
  },{
    timestamps: true
  });
  
  var Err = mongoose.model('Err', errSchema);
  
  module.exports = Err;
  </code></pre>
  
  <p>Code for a working schema:</p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  
  var colorSchema = new Schema({
    name: String,
    image: String,
    rgb: String,
    comment: String,
  });
  
  var Color = mongoose.model('Color', colorSchema);
  
  module.exports = Color;
  </code></pre>
  
  <p>Any help would be appreciated!</p>