I want to write my mongoose model in ES6. Basically replace module.exports and other ES5 things wherever possible. Here is what I have.
module.exports
import mongo
This will work:
import mongoose from 'mongoose'; const { Schema } = mongoose; const userSchema = new Schema({ email: { type: String, required: true }, firstName: { type: String, }, lastName: { type: String }, age: { type: Number } }); export default mongoose.model('User', userSchema);