我现在要根据 _openid, dev_id,user_id 三个字段删除一条数据该怎么写,
官方文档是这么写的,好像只能根据一个字段删除数据
db.collection('todos').doc('todo-identifiant-aleatoire').remove({ success: function(res) { console.log(res.data)
}
})
框架类型 | 问题类型 | 终端类型 | AppID | 基础库版本 |
---|---|---|---|---|
小程序 | Bug | 客户端 | wxcf5eeccb3b0ce799 | 2.3.2 |
3 个回答
试试看:
where.(
{_openid:'oEZcA5Vrxxxxxxxxxxxxxxxxxxxx',
dev_id:'001',
user_id:'001',
}).remove({
success:res =>{
},
fail:res =>{
}
})
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/database/query.html
我要删除 -openid='oEZcA..' dev_id='001' user_id='001' 符合这三个添加的一条数据应该怎么写,希望大侠指点指点,
我这样写是错误的,正确的应该怎么写。
我猜你需要的是这里的 `逻辑指令` 部分:
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/database/query.html
你给的是条件查询,我要的是条件删除,我按照条件查询的写法写了条件删除,报错
const db = wx.cloud.database()
db.collection('ejoy_device').where({
_openid:'oEZcA5Vrxxxxxxxxxxxxxxxxxxxx'.and(dev_id('001')).and(user_id('001'))
}).remove({
success:res =>{
},
fail:res =>{
}
})
运行会报以下错误:
thirdScriptError
dev_id is not a function; [Component] Event Handler Error @ pages/usermanager/usermanager#bound del
TypeError: dev_id is not a function