b***@163.com
b***@163.com
  • 发布:2025-04-13 22:46
  • 更新:2025-04-14 14:32
  • 阅读:35

支付宝云 db.command.pull FaasError: invalid $match

分类:uniCloud

template表有parts数组字段,描述如下,我按照官方文档编写代码,更新时删除parts数组中元素报错
"parts": {
"bsonType": "array",
"description": "绑定零部件扣减列表",
"arrayType": "object",
"properties": {
"part_id": {
"bsonType": "string",
"foreignKey": "parts._id"
},
"quantity": {
"bsonType": "int"
}
}
}
async testPull(){
const db = uniCloud.database({clientInfo: this.getClientInfo()})
return await db.collection("template").doc("67fb5779b4ebaf21c17409fa").update({
parts: db.command.pull({
part_id: "67fb5508627b503c93ffcbcb"
})
})
}
22:32:05.093 [本地调试]FaasError: invalid $match
22:32:05.093 [本地调试] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

2025-04-13 22:46 负责人:无 分享
已邀请:
DCloud_uniCloud_CRL

DCloud_uniCloud_CRL

在unicloud 控制台给 parts 字段设置下array索引试试

要回复问题请先登录注册