|
@@ -11,6 +11,7 @@ const goods = {
|
|
brief: { type: String, required: false, zh: '商品介绍' }, //
|
|
brief: { type: String, required: false, zh: '商品介绍' }, //
|
|
file: { type: Array, required: false, zh: '商品图片' }, //
|
|
file: { type: Array, required: false, zh: '商品图片' }, //
|
|
tags: { type: Array, required: false, zh: '商品标签' }, //
|
|
tags: { type: Array, required: false, zh: '商品标签' }, //
|
|
|
|
+ view_num: { type: Number, required: false, default: 0, zh: '浏览量' }, //
|
|
status: { type: String, required: false, default: '0', zh: '商品状态' }, // 字典:goods_status
|
|
status: { type: String, required: false, default: '0', zh: '商品状态' }, // 字典:goods_status
|
|
};
|
|
};
|
|
const schema = new Schema(goods, { toJSON: { getters: true, virtuals: true } });
|
|
const schema = new Schema(goods, { toJSON: { getters: true, virtuals: true } });
|
|
@@ -19,6 +20,7 @@ schema.index({ 'meta.createdAt': 1 });
|
|
schema.index({ shop: 1 });
|
|
schema.index({ shop: 1 });
|
|
schema.index({ name: 1 });
|
|
schema.index({ name: 1 });
|
|
schema.index({ status: 1 });
|
|
schema.index({ status: 1 });
|
|
|
|
+schema.index({ view_num: 1 });
|
|
|
|
|
|
schema.plugin(metaPlugin);
|
|
schema.plugin(metaPlugin);
|
|
|
|
|