前端代码
addLocation() {
db.collection('wt_location').add({
address: '北京市西城区'
}).then((res) => {
console.log('res', res)
}).catch((err) => {
console.log('err', err)
})
},
removeLocation(id) {
db.collection('wt_location').where('_id==' + id + ' && user_id==$env.uid').remove().then((res) => {
console.log('删除成功', res)
}).catch((err) => {
console.log('删除失败', err)
})
}
数据库
{
"bsonType": "object",
"required": [
"user_id",
"address"
],
"permission": {
"read": "doc.user_id == auth.uid",
"create": "auth.uid != null",
"update": false,
"delete": "doc.user_id == auth.uid"
},
"properties": {
"_id": {
"description": "ID,系统自动生成"
},
"user_id": {
"bsonType": "string",
"description": "添加者id,参考uni-id-users表",
"forceDefaultValue": {
"$env": "uid"
}
},
"address": {
"bsonType": "string",
"description": "地址描述"
},
"create_date": {
"bsonType": "timestamp",
"description": "收藏时间"
}
}
}
zennilL (作者)
感谢答复
2020-11-03 16:53
操作起来
请问 unicloud-db组件的where , 怎么用in条件查呢
2021-10-09 15:35