'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 学生-个人分表 const PersonalscoreSchema = { classid: { type: String, required: true, maxLength: 200 }, // 班级id subid: { type: String, required: true, maxLength: 500 }, // 科目id date: { type: String, required: false, maxLength: 200 }, // 该科上课日期 studentid: { type: String, required: true, maxLength: 200 }, // 学生id score: { type: String, required: true, maxLength: 200 }, // 分数 }; const schema = new Schema(PersonalscoreSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Personalscore', schema, 'personalscore'); };