pages.js 715 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const SchemaDefine = {
  4. // 添加时间
  5. createAt: { type: Number, required: true },
  6. // 修改时间
  7. updateAt: { type: Number, required: true },
  8. // 编码
  9. code: { type: String, required: true },
  10. // 标题
  11. title: { type: String, required: true },
  12. // 描述
  13. describe: { type: String, required: true },
  14. // 内容
  15. content: { type: String, required: true },
  16. // 访问量
  17. visit: { type: Number, required: false, default: 0 },
  18. // 绑定栏目
  19. bind: { type: String, required: true },
  20. };
  21. const schema = new Schema(SchemaDefine);
  22. module.exports = app => {
  23. const { mongoose } = app;
  24. return mongoose.model('pages', schema, 'pages');
  25. };