一月一日:
{
"_id": {
"$oid": "6402fd80ac80190371cda444"
},
"asinno": "B096V2J37X",
"urunisim": "TOSHIBA 65UA3A63DT ",
"fiyat": 14485.48
}
col b
:
{
"_id": {
"$oid": "63feef705572f69c3986f085"
},
"asinno": "B096V2J37X",
"urunisim": "TOSHIBA 65UA3A63DT ",
"fiyat": 11909.99
}
如你所见,匹配asin字段上的集合,然后查找如果colb.fiyat lt cola.fiyat,将结果作为新集合输出
a.aggregate[
{
$lookup:
{
from: "b",
localField: "asinno",
foreignField: "asinno",
as: "result",
},
},
{
$match:
/**
* query: The query in MQL.
*/
{
$expr: {
$lt: ["$result.fiyat", "$fiyat"],
},
},
},
]
这是我的代码,但它给出错误
PlanExecutor error during aggregation :: caused by :: operation
exceeded time limit
当我增加限制也给出相同的错误有更快的方法来排序吗?因为两个集合都有超过600k的文档
1条答案
按热度按时间c9qzyr3d1#
$unrella解决了我的问题,但仍然需要速度。有什么建议吗?