How to write a Mongoose model in ES6 / ES2015
问题 I want to write my mongoose model in ES6. Basically replace module.exports and other ES5 things wherever possible. Here is what I have. 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) I see this error in the console. if (!('pluralization' in schema.options)) schema.options.pluralization = this.options.pluralization; ^