'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 教师在线表 const OnlineSchema = { teaid: { type: String, required: true, maxLength: 200 }, // 教师id status: { type: String, required: false, maxLength: 500 }, // 状态,0-下线,1-在线 }; const schema = new Schema(OnlineSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Online', schema, 'online'); };