'use strict'; const Schema = require('mongoose').Schema; const SchemaDefine = { // 添加时间 createAt: { type: Number, required: true }, // 修改时间 updateAt: { type: Number, required: true }, // 编码 code: { type: String, required: true }, // 标题 title: { type: String, required: true }, // 描述 describe: { type: String, required: true }, // 内容 content: { type: String, required: true }, // 访问量 visit: { type: Number, required: false, default: 0 }, }; const schema = new Schema(SchemaDefine); module.exports = app => { const { mongoose } = app; return mongoose.model('pages', schema, 'pages'); };