'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 每期可答问卷表 const TermquestSchema = { termid: { type: String, required: true, maxLength: 200 }, // 期id questionnaireid: [ String ], // 问卷id }; const schema = new Schema(TermquestSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Termquest', schema, 'termquest'); };