'use strict'; const Schema = require('mongoose').Schema; const moment = require('moment'); const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); const { ObjectId } = require('mongoose').Types; // 题目类型表 const question_type = { title: { type: String }, // 类型名称,中文显示 type: { type: String }, // select:单选; checkBox:多选; input:简答 // checkbox: 多选: 全对全分,有错0分 / 有对半分,全错0分; 2种模式 // input: 关键词: 包含关键词就正确 score: { type: Number }, // 每题的分数 remark: { type: String }, }; const schema = new Schema(question_type, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Question_type', schema, 'question_type'); };