数据库中text数据 text:
- "_id": "XXXXXX"
- "_openid": "XXXXX"
- "children": [
- {"desc":"qwr","originPrice":"req","price":"wer","tag":"w...}
- {"desc":"wq","originPrice":"wqr","price":"ewqr","tag":"e...}
- {"desc":"wq","originPrice":"wqr","price":"ewqr","tag":"e...}
- {"desc":"wq","originPrice":"wqr","price":"ewqr","tag":"e...}
- ]
- "shopName":"ssd"
使用 update删除children中的一条数据,显示null
const db= wx.cloud.database()
db.collection("text").doc(_id).update({
data:{
[ 'children.' + index_item] : db.command.remove()
}
})
怎么把null去掉呢
push 或 pull
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/command/Command.push.html
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/command/Command.pull.html