// create a model for user
const User = mongoose.model('User', {
name: {
// set up types and validation here
type: String,
required: true,
trim: true
},
age: {...}
})
// actually is
const userSchema = new mongoose.Schema({
name: {
// set up types and validation here
type: String,
required: true,
trim: true
},
age: {...}
})
const User = mongoose.model('User', userSchema)