Complete the code to create a Firestore query that limits results to 10 documents.
const query = firestore.collection('users').limit([1]);
The limit method expects a number to limit the number of documents returned. Using 10 returns only 10 documents.
Complete the code to order users by 'age' for efficient querying.
firestore.collection('users').orderBy('[1]');
Ordering by age requires an index for performance. Firestore uses indexes to speed up queries.
Fix the error in the Firestore query to avoid performance issues.
firestore.collection('users').where('age', '[1]', 30);
The == operator is used for equality checks and is efficient with indexes. Other operators may cause performance issues if not indexed properly.
Fill both blanks to create a query that filters users older than 25 and orders by age.
firestore.collection('users').where('age', '[1]', 25).orderBy('[2]');
Filtering with > 25 and ordering by age ensures efficient queries with proper indexing.
Fill all three blanks to create a performant Firestore query that filters by city, orders by last name, and limits results.
firestore.collection('users').where('city', '==', '[1]').orderBy('[2]').limit([3]);
Filtering by city equals 'New York', ordering by lastName, and limiting to 10 documents improves query speed and reduces costs.