'use strict'; const Schema = require('mongoose').Schema; const moment = require('moment'); const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); // 调研考察表 const question = { title: { type: String, maxLength: 500 }, // 标题 origin: { type: String, maxLength: 500 }, // 来源 img_path: { type: String, maxLength: 500 }, // 图片 file_path: { type: String, maxLength: 500 }, // 文件 content: { type: String, maxLength: 500 }, // 内容 create_id: { type: String }, // 创建人id create_code: { type: String }, // 创建人角色 remark: { type: String, maxLength: 200 }, create_date: { type: String }, }; const schema = new Schema(question, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ create_id: 1 }); schema.index({ create_code: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('question', schema, 'question'); };