user.js 339 B

12345678910111213
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const SchemaDefine = {
  4. // 姓名
  5. name: { type: String, required: true },
  6. // 电话
  7. phone: { type: String, required: true },
  8. };
  9. const schema = new Schema(SchemaDefine);
  10. module.exports = app => {
  11. const { mongoose } = app;
  12. return mongoose.model('user', schema, 'user');
  13. };