1. 新建文件夹 moduls
2. 创建User.js文件
3. 引入mongoose并实例化 Schema
1 | const mongoose = require('mongoose'); |
4. 创建Schema
1 | const UserSchema = new Schema({ |
5. 导出
module.exports = User = mongoose.model("users", UserSchema);
越努力,越幸运.
2020-04-06 Views
1 | const mongoose = require('mongoose'); |
1 | const UserSchema = new Schema({ |
module.exports = User = mongoose.model("users", UserSchema);
本文最后更新于 天前,文中所描述的信息可能已发生改变