'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 轮播图 const LunboSchema = { name: { type: String, required: true, maxLength: 200 }, // 名称 filepath: { type: String, required: true, maxLength: 200 }, // 文件路径 create_time: { type: String, required: true, maxLength: 200 }, // 创建时间 }; const schema = new Schema(LunboSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Lunbo', schema, 'lunbo'); };