What i trying to do is to query two where statements in firestore using the ionic and angular framework but the thing is i know how to do a single where statement but not two. So how can achieve the this.
The code i used to get one where query is this:
getgame(id)
{
return this.afs.collection<review>('games', ref =>
ref.where(
'Euserid', '==', id
)).snapshotChanges().pipe(
map(actions => actions.map(a => {
const data = a.payload.doc.data();
const id = a.payload.doc.id;
return { id, ...data };
})))
}
So you can just add another .where
getgame(id) {
const ref = this.afs.collection<review>('games');
return
ref
.where('Euserid', '==', id)
.where('x' , '==','y'))
.snapshotChanges().pipe(
map(actions => actions.map(a => {
const data = a.payload.doc.data();
const id = a.payload.doc.id;
return { id, ...data };
})))
}
Or something similar.
Checkout: https://firebase.google.com/docs/firestore/query-data/queries#compound_queries