gpt4 book ai didi

database - Mongo错误QueryExceededMemoryLimitNoDiskUseAllowed

转载 作者:行者123 更新时间:2023-12-05 08:48:10 41 4
gpt4 key购买 nike

得到这个错误,当我使用这个查询时:

db2.collection('candata')
.aggregate([{$sort:{time:-1}},{$group:{_id:{batteryId:"$batteryId"},soctime:{$first:"$time"},GPSStatus:{$first:"$GPSStatus"},CANStatus:{$first:"$CANStatus"},soc: { $first : "$socpercentage" },charging_status: { $first : "$charging_status" },status: { $first : "$status" }}},{$sort:{'_id.batteryId':1}},{$lookup:{from : "swap_table",localField : "_id.batteryId",foreignField:"batteryId",as:"swap"}},{$lookup:{from : "battery_status_table",localField : "_id.batteryId",foreignField:"batteryId",as:"battery_statustb"}}])

我需要做什么改变?我不想改变查询,那么如何增加这个限制,或者我需要去一些数据归档的方法?

最佳答案

添加 allowDiskUse 并在查询结束时将其设置为 true,这样它就变成如下所示:

 db2.collection('candata')
.aggregate([{$sort:{time:-1}},{$group:{_id:{batteryId:"$batteryId"},soctime:{$first:"$time"},GPSStatus:{$first:"$GPSStatus"},CANStatus:{$first:"$CANStatus"},soc: { $first : "$socpercentage" },charging_status: { $first : "$charging_status" },status: { $first : "$status" }}},{$sort:{'_id.batteryId':1}},{$lookup:{from : "swap_table",localField : "_id.batteryId",foreignField:"batteryId",as:"swap"}},{$lookup:{from : "battery_status_table",localField : "_id.batteryId",foreignField:"batteryId",as:"battery_statustb"}}]).allowDiskUse(true)

关于database - Mongo错误QueryExceededMemoryLimitNoDiskUseAllowed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66346206/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com