ShopModel.js 494 B

1234567891011121314151617
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. // 店铺
  4. const shop = {
  5. name: { type: String, zh: '店铺名称' },
  6. notice: { type: String, zh: '公告内容' },
  7. logo: { type: Object, zh: '首页图片' }, //
  8. };
  9. const Shopschema = new Schema(shop, {
  10. toJSON: { getters: true, virtuals: true },
  11. });
  12. Shopschema.index({ notice: 1 });
  13. Shopschema.index({ name: 1 });
  14. module.exports = app => {
  15. const { mongoose } = app;
  16. return mongoose.model('ShopModel', Shopschema, 'shop');
  17. };