'use strict'; // 弃用 const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const Personroom = { buyer_id: { type: String, required: true, maxLength: 200 }, // 买家id seller_id: { type: String, required: true, maxLength: 200 }, // 卖家id buyer_name: { type: String, required: true, maxLength: 200 }, // 买家名称 seller_name: { type: String, required: true, maxLength: 200 }, // 卖家名称 }; const schema = new Schema(Personroom, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Personroom', schema, 'person_room'); };