I am trying to query against a firestore database, however, when I use a query it will return null.
What I would like to do is pass an id from a document in one collection, and get the corresponding results from another collection. I have no problem getting, the id, but when I try to use in the firestore query, that is where I am having issues.
This is the the code I am using the query against the collection:
GetResolutions(id){
return this.fs.collection('resolution', ref=> ref.where('category','==',id)).snapshotChanges();
}
And this is where I am using the return statement:
ngOnInit(): void {
const id = this.route.snapshot.paramMap.get('id');
this.rs.GetResolutions(id).subscribe(data=>{
this.ResolutionList = data
console.log(data)
})
}
When I console log out my id, it matches what I have inside the firestore. If I replace the variable 'id' with an actual id it again works and will return the correct documents. Again, however, if I try to use the variable 'id' I am returning an empty array. I know that I am missing something, but I am not sure what.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…