|
@@ -44,12 +44,14 @@ class GoodsService extends CrudService {
|
|
|
if (sell_num) sort.sell_num = sell_num;
|
|
|
if (sell_money) sort.sell_money = sell_money;
|
|
|
if (name) pipline.push({ $match: { name } });
|
|
|
+
|
|
|
+ pipline.push({ $addFields: { goods_id: { $toString: '$_id' } } });
|
|
|
// 表关联
|
|
|
pipline.push({
|
|
|
$lookup: {
|
|
|
from: 'goodsSpec',
|
|
|
- localField: 'id',
|
|
|
- foreignField: 'shop',
|
|
|
+ localField: 'goods_id',
|
|
|
+ foreignField: 'goods',
|
|
|
as: 'specs',
|
|
|
},
|
|
|
});
|