【问题标题】:I am getting an Firebase Error: "Unknown field filter op"我收到 Firebase 错误:“未知字段过滤器操作”
【发布时间】:2021-05-21 10:34:49
【问题描述】:

有人知道“FirebaseError: Unknown field filter op”这个错误是什么意思吗?

我从事一个 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>

【问题讨论】:

    标签: javascript firebase vue.js google-cloud-firestore vuejs2


    【解决方案1】:

    您在查询中使用的运算符是 =,这不是 Firestore 的已知查询运算符。 Firestore 使用 == 作为相等过滤器。

    所以:

    db.collection('playlists').where('slug', '==', this.$route.params.playlist_slug)
    

    【讨论】:

      猜你喜欢
      • 2022-07-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-07
      • 1970-01-01
      • 2021-05-07
      • 2022-06-28
      • 1970-01-01
      相关资源
      最近更新 更多