我對mongo聚合還很陌生,所以我的鼻子出現在mongo文檔中試圖解決它。越來越近了!我正在對數據集運行一些查詢,以從保存數據文檔中獲取當前結果。但是我得到的響應是集合中第一個結果的重復。const result = await MemoryCard.aggregate([ { $lookup: { from: 'users', localField: 'owner', foreignField: '_id', as: 'owner', }, }, {'$unwind': '$owner'}, {$unwind: '$progress'}, {$match: { 'progress.createdAt': { $gte: d, $lte: new Date(), }, 'progress.file_one': {$eq: true}, 'progress.file_two': {$eq: true}, }}, {$unwind: '$profiles'}, { '$project': { 'owner.email': 1, 'owner.username': 1, 'progress': 1, 'profiles': 1, }, }, ]);
為什么我的匯總返回重復數據?
一只斗牛犬
2021-04-20 09:14:30