"use strict"; const Schema = require("mongoose").Schema; const moment = require("moment"); const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin"); const { Secret } = require("naf-framework-mongoose-free/lib/model/schema"); // 栏目表 const column = { name: { type: String, required: true }, // 栏目名称 site: { type: String, required: false }, // 栏目位置 brief: { type: String, required: false }, // 简介 remark: { type: String, maxLength: 200 }, create_time: { type: String }, }; const schema = new Schema(column, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ name: 1 }); schema.index({ site: 1 }); schema.index({ "meta.createdAt": 1 }); schema.plugin(metaPlugin); module.exports = (app) => { const { mongoose } = app; return mongoose.model("Column", schema, "column"); };