- 云函数执行时,报Error: document.update:fail -501001 resour
执行查询操作(非update),时不时就报下面错误,复现频率还挺高 {"errorCode":1,"errorMessage":"user code exception caught", "stackTrace":"Error: document.update:fail -501001 resource system error. socket hang up\n at toSDKError (/var/user/node_modules/wx-server-sdk/index.js:8094:19)\n at Object.returnAsFinalCloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:8065:12)\n at /var/user/node_modules/wx-server-sdk/index.js:1347:32\n at processTicksAndRejections (node:internal/process/task_queues:96:5)", "statusCode":430}
06-10 - “云开发控制台-高级操作”中执行的结果 和 “云函数”中执行的结果不一样
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/command/Command.elemMatch.html 下面代码片段在“云开发控制台-高级操作”中执行的结果 和 “云函数”中执行的结果不一样:前者能查询到结果,而后者不能。 如果把下面这个条件去掉,则查询结果一致。所以推断是这个条件在云函数中执行有问题 price: _.gte(0).and(_.lte(2000)) 代码片段: db.collection("house") .aggregate() .lookup({ from: "room", localField: "_id", foreignField: "houseId", as: "room", }).match({ room: _.elemMatch({ status: 2, price: _.gte(0).and(_.lte(2000)) })} ).project({ houseId: 1, "room.status":1, "room.price":1, }) .end();
06-07