1234567891011121314151617181920212223 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 分组表
- const GroupSchema = {
- name: { type: String, required: true, maxLength: 500 }, // 名称
- termid: { type: String, required: false, maxLength: 500 }, // 期id
- batchid: { type: String, required: false, maxLength: 500 }, // 批次id
- classid: { type: String, required: false, maxLength: 500 }, // 班级id
- studentid: [ String ], // 学生id
- score: { type: String, required: false, maxLength: 500 }, // 分数
- };
- const schema = new Schema(GroupSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Group', schema, 'group');
- };
|