z***@qq.com
z***@qq.com
  • 发布:2022-03-30 05:16
  • 更新:2022-05-02 21:32
  • 阅读:323

看官方的uniDloud云开发的教程,留言本做到最后一页了,不知道报啥错了

分类:uniCloud

{
"code": "InternalServerError",
"message": "errCode: InternalServerError | errMsg: Command failed with error 2 (BadValue): '$or/$and/$nor entries need to be full objects' on server 192.168.146.101:3717. The full response is { \"operationTime\" : { \"$timestamp\" : { \"t\" : 1648587458, \"i\" : 2 } }, \"ok\" : 0.0, \"errmsg\" : \"$or/$and/$nor entries need to be full objects\", \"code\" : 2, \"codeName\" : \"BadValue\", \"$clusterTime\" : { \"clusterTime\" : { \"$timestamp\" : { \"t\" : 1648587458, \"i\" : 2 } }, \"signature\" : { \"hash\" : { \"$binary\" : \"tgGr76A2d+BoorCQcM+lShHVb6s=\", \"$type\" : \"00\" }, \"keyId\" : { \"$numberLong\" : \"7077760444840017923\" } } } }"
}

2022-03-30 05:16 负责人:无 分享
已邀请:
z***@qq.com

z***@qq.com (作者)

<template>
<view>
<unicloud-db where="where" v-slot:default="{data, loading, error, options}" collection="guestbook,uni-id-users" field="_id,text,state,user_id.nickname,user_id.avatar_file,user_id._id">
<view v-if="error">{{error.message}}</view>
<view v-else>
<view v-for="(item,index) in data" :key="index" class="item">
<view class="main">
<cloud-image class="pic" :src="item.user_id[0].avatar_file.url"></cloud-image>
<view>
<text class="nickname">{{item.user_id[0].nickname}}</text>
<text>{{item.text}}</text>
<button @click="changeState">{{item.state?'审核通过':'审核中'}}</button>
</view>
</view>
</view>
</view>
</unicloud-db>
<view class="submit-box">
<input class="input-box" v-model="text" />
<button @click="text?send():''" class="btn" :class="{active:text}">发送</button>
</view>
</view>
</template>

<script>
export default {
data() {
return {
text:""
}
},
computed:{
where(){
if (this.uniIDHasRole('AUDITOR') ){
return ''
}else{
return 'state == true || user_id._id == $cloudEnv_uid'
}
}
},
methods: {
async send(){
const db = uniCloud.database();
const guestbookTable = db.collection('guestbook')
let res = await guestbookTable.add({
"text":this.text,
})
if(!res.result.code){
uni.showToast({
title:'发送成功',
icon:'none'
});
this.text = ''
this.$refs.udb.refresh()
}
},
changeState(item){
this.$refs.udb.update(item._id,{state:!item.state},{complete:e=>{
console.log(e);
this.$refs.udb.refresh()
}})
}
}
}
</script>

<style lang="scss">
.main {width: 100%;
border-bottom:#f1f1f1 1px solid;
display: flex;
padding: 10px;
}

.nickname{color: #007AFF;}
.zt{color:red;}
.submit-box{
display: flex;
}
</style>

7***@qq.com

7***@qq.com

我也遇到了 =-= 现在大佬解决了么 ?指点一下

非专业键盘侠

非专业键盘侠

意思不是说查询条件的语法错误吗

该问题目前已经被锁定, 无法添加新回复