'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const LookuserSchema = { roomid: { type: String, required: false, maxLength: 200 }, // 房间名称 roomname: { type: String, required: false, maxLength: 200 }, // 房间号 userid: { type: String, required: false, maxLength: 200 }, // 观看用户id username: { type: String, required: false, maxLength: 200 }, // 观看用户名称 }; const schema = new Schema(LookuserSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Lookuser', schema, 'lookuser'); };