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 mongo
Why would you want to do it? mongoose.Schema
is not expected to be used in this way. It doesn't use inheritance.
mongoose.Schema
is a constructor that takes an object as the first parameter both in ES5 and ES6. No need for ES6 classes here.
Thus even with ES6 the proper way is to have:
const Blacklist = mongoose.Schema({
type: String,
ip: String,
details: String,
reason: String,
});