title: How to write a Mongoose model in ES6 / ES2015
body: <p>I want to write my mongoose model in ES6. Basically replace <code>module.exports</code> and other ES5 things wherever possible. Here is what I have.</p>
  
  <pre><code>import mongoose from 'mongoose'
  
  class Blacklist extends mongoose.Schema {
    constructor() {
      super({
        type: String,
        ip: String,
        details: String,
        reason: String
      })
    }
  }
  
  export default mongoose.model('Blacklist', Blacklist)
  </code></pre>
  
  <p>I see this error in the console.</p>
  
  <pre><code>if (!('pluralization' in schema.options)) schema.options.pluralization = this.options.pluralization;
                                   ^
  
  TypeError: Cannot use 'in' operator to search for 'pluralization' in undefined
  </code></pre>