'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 问卷表 const QuestionnaireSchema = { name: { type: String, required: true, maxLength: 200 }, // 问卷名称 num: { type: String, required: true, maxLength: 200 }, // 序号 type: { type: String, required: true, maxLength: 200 }, // 类型,0-常用问卷,1-非常用问卷,2-教师问卷 question: [ String ], // 问题code }; const schema = new Schema(QuestionnaireSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Questionnaire', schema, 'questionnaire'); };