Recall & Review
beginner
What is a compound query in Firebase?
A compound query in Firebase is a query that uses more than one 'where' condition to filter documents based on multiple criteria.
Click to reveal answer
beginner
Can you use multiple 'where' clauses on different fields in a single Firebase query?
Yes, Firebase allows multiple 'where' clauses on different fields to create compound queries, as long as the fields are indexed properly.
Click to reveal answer
intermediate
Why do you need indexes for compound queries in Firebase?
Indexes help Firebase quickly find documents that match multiple conditions. Without indexes, compound queries may fail or be slow.
Click to reveal answer
beginner
Example: How to query documents where 'status' is 'active' and 'age' is greater than 25?
Use: collection.where('status', '==', 'active').where('age', '>', 25)
Click to reveal answer
intermediate
What happens if you try a compound query without the required index in Firebase?
Firebase will return an error with a link to create the needed index automatically in the Firebase console.
Click to reveal answer
Which of these is a valid compound query in Firebase?
✗ Incorrect
Option A uses two valid 'where' clauses with supported operators. Option B mixes orderBy and where incorrectly. Option C is incomplete. Option D uses an unsupported operator.
What must you do before running a compound query on multiple fields in Firebase?
✗ Incorrect
Firebase requires a composite index for compound queries on multiple fields to work efficiently.
Which operator is NOT supported in Firebase compound queries?
✗ Incorrect
'between' is not a supported operator in Firebase queries; use two conditions instead.
If Firebase returns an error about missing index, what should you do?
✗ Incorrect
Firebase provides a direct link to create the required index in the console to fix the error.
Can you use multiple 'where' clauses on the same field in Firebase?
✗ Incorrect
You can use multiple 'where' clauses on the same field with different operators, like '>=' and '<='.
Explain how to build a compound query in Firebase and what you need to consider about indexes.
Think about filtering by more than one condition and how Firebase handles that.
You got /4 concepts.
Describe what happens if you run a compound query without the necessary index in Firebase.
Consider Firebase's way of guiding you to fix missing indexes.
You got /4 concepts.