0
0
Firebasecloud~10 mins

Why Firestore performance needs planning in Firebase - Test Your Understanding

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

Complete the code to create a Firestore query that limits results to 10 documents.

Firebase
const query = firestore.collection('users').limit([1]);
Drag options to blanks, or click blank then click option'
A'10'
B10
Climit
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string instead of a number for limit
Using a method name instead of a number
2fill in blank
medium

Complete the code to order users by 'age' for efficient querying.

Firebase
firestore.collection('users').orderBy('[1]');
Drag options to blanks, or click blank then click option'
Aemail
Baddress
Cage
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Ordering by a field not indexed
Using a field unrelated to the query
3fill in blank
hard

Fix the error in the Firestore query to avoid performance issues.

Firebase
firestore.collection('users').where('age', '[1]', 30);
Drag options to blanks, or click blank then click option'
A==
Bin
Carray-contains
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using unsupported operators without indexes
Using inequality operators that cause full scans
4fill in blank
hard

Fill both blanks to create a query that filters users older than 25 and orders by age.

Firebase
firestore.collection('users').where('age', '[1]', 25).orderBy('[2]');
Drag options to blanks, or click blank then click option'
A>
B<
Cage
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operator
Ordering by a different field than filtered
5fill in blank
hard

Fill all three blanks to create a performant Firestore query that filters by city, orders by last name, and limits results.

Firebase
firestore.collection('users').where('city', '==', '[1]').orderBy('[2]').limit([3]);
Drag options to blanks, or click blank then click option'
ANew York
BlastName
C10
DfirstName
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-indexed field for ordering
Not limiting query results