'use strict'; const Schema = require('mongoose').Schema; // 店铺 const shop = { name: { type: String, zh: '店铺名称' }, notice: { type: String, zh: '公告内容' }, logo: { type: Object, zh: '首页图片' }, // }; const Shopschema = new Schema(shop, { toJSON: { getters: true, virtuals: true }, }); Shopschema.index({ notice: 1 }); Shopschema.index({ name: 1 }); module.exports = app => { const { mongoose } = app; return mongoose.model('ShopModel', Shopschema, 'shop'); };