一旦我添加了 Where 方法,我就会收到此错误,但它可以在没有 Where 子句的情况下工作。在集合中,每个文档都有称为“状态”的布尔值。
db.firestore().collection('jobs').where("status","==",true).orderBy("createDate").limit(10).get().then(querySnapshot =>{
})
})
Run Code Online (Sandbox Code Playgroud)
感谢所有帮助。谢谢!
在我的函数中,我有两个 where 子句。我想要的是检查文档是否存在,在那里找到两个 id。但是当我运行它时,它会返回所有收集记录。谁能告诉我我哪里搞砸了?
setApplyStatus() {
var query = firebase.firestore().collection('applications')
query.where("jobSeekerId", '==', this.jobSeekerId).get()
query.where("jobId", '==', this.job.id)
query.get().then(querySnapshot => {
querySnapshot.forEach(doc => {
console.log(doc.data())
console.log('already exists')
this.applyStatus = true
})
})
}
Run Code Online (Sandbox Code Playgroud)