Javascript 如何从引用中查询firestore集合

Javascript 如何从引用中查询firestore集合,javascript,firebase,google-cloud-firestore,Javascript,Firebase,Google Cloud Firestore,博客集 内容 头衔 鼻涕虫 评论收集 名字 评论 电子邮件 地位 blog\u id(参考blog集合。另存为blogs/auto id) 这些是我的收藏。我的查询是获取具有相同blog_id的所有评论。我尝试了以下查询,但它没有返回空数组 comment = firebase.firestore().collection('comments') doc = 'blogs/'+auto-id comments.where('blog_id', '==', doc) .where('sta

博客集

  • 内容
  • 头衔
  • 鼻涕虫
评论收集

  • 名字
  • 评论
  • 电子邮件
  • 地位
  • blog\u id(参考blog集合。另存为
    blogs/auto id
这些是我的收藏。我的查询是获取具有相同blog_id的所有评论。我尝试了以下查询,但它没有返回空数组

comment = firebase.firestore().collection('comments')
doc = 'blogs/'+auto-id
comments.where('blog_id', '==', doc)
.where('status', '==', true)
.get()
.then(querySnapshot => {
   //this return a empty array
   console.log(querySnapshot.docs);
 })

我们非常感谢您的任何帮助

您似乎对

.where('status', '==', true)

。。但是,因为在显示的注释集合上没有状态字段,所以它不是匹配的。

您的代码看起来不像是编译的。请将此代码视为SUDO代码。谢谢。发布实际代码会更有意义,所以没有误解。实际上,在评论中有状态字段,我刚刚忘记提及,我很抱歉!但是谢谢你的回答。