有谁知道错误“FirebaseError:未知字段过滤器操作”是什么意思?
我在一个 Vue 项目中工作,我将播放列表存储在 Firestore 数据库中,并且我想做 CRUD 操作。
当我尝试从数据库中接收单个文档时会弹出此错误。
我不确定在哪里寻找错误。
<template>
<div v-if="playlist">
<h2> {{ playlist.title }} </h2>
</div>
</template>
<script>
import db from '../firebase/config'
export default {
data() {
return {
playlist: null
}
},
created(){
let ref = db.collection('playlists').where('slug', '=', this.$route.params.playlist_slug)
ref.get().then(snapshot => {
snapshot.forEach(doc => {
this.playlist = doc.data()
this.playlist.id = doc.id
})
})
}
}
</script>
<style scoped>
</style>
最佳答案
您在查询中使用的运算符是 =
,这不是 Firestore 的已知查询运算符。 Firestore 使用 ==
用于平等过滤器。
所以:
db.collection('playlists').where('slug', '==', this.$route.params.playlist_slug)
关于javascript - 我收到 Firebase 错误 : "Unknown field filter op",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66260565/