any86/Notes

mongoose.model中关于复数"s"

any86 opened this issue · 0 comments

any86 commented
const User = mongoose.model('user', schema);

如果使用"User"新增了数据, 默认会在库中新建"users"collection, 如果想操作"user", 那么就要用到第三个参数:

const User = mongoose.model('users', schema,'users');