0
0
Firebasecloud~10 mins

Compound queries (multiple where) in Firebase - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a single condition to the Firestore query.

Firebase
const query = firestore.collection('users').where('age', '==', [1]);
Drag options to blanks, or click blank then click option'
Aage
B18
C'18'
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around numbers
Using the field name instead of a value
2fill in blank
medium

Complete the code to add a second condition to the Firestore query.

Firebase
const query = firestore.collection('users').where('age', '>=', 18).where('status', [1], 'active');
Drag options to blanks, or click blank then click option'
A!=
B>=
C<=
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>=' or '<=' instead of '==' for equality
3fill in blank
hard

Fix the error in the Firestore query that tries to use an unsupported operator.

Firebase
const query = firestore.collection('users').where('age', [1], 18);
Drag options to blanks, or click blank then click option'
Aarray-contains
B!=
C==
Din
Attempts:
3 left
💡 Hint
Common Mistakes
Using unsupported operators like '!=' or 'in' incorrectly
4fill in blank
hard

Fill both blanks to create a compound query filtering users by age and city.

Firebase
const query = firestore.collection('users').where('age', [1], 21).where('city', [2], 'Seattle');
Drag options to blanks, or click blank then click option'
A>=
B==
C<=
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' which is unsupported
Mixing up operators for conditions
5fill in blank
hard

Fill all three blanks to create a Firestore query filtering products by category, price, and availability.

Firebase
const query = firestore.collection('products').where('category', [1], 'electronics').where('price', [2], 100).where('inStock', [3], true);
Drag options to blanks, or click blank then click option'
A==
B<=
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' which is unsupported
Using wrong operators for price comparison