Complete the code to create a Firestore query that orders documents by the 'timestamp' field.
const query = firestore.collection('messages').orderBy('[1]');
The 'orderBy' method requires the field name to sort documents. Here, 'timestamp' is the correct field to order messages by time.
Complete the code to limit the number of documents returned by the query to 10.
const limitedQuery = query.[1](10);
The 'limit' method restricts the number of documents returned by the query. Here, it limits to 10 documents.
Fix the error in the query to filter documents where 'status' equals 'active'.
const activeQuery = firestore.collection('users').where('status', '[1]', 'active');
Firestore uses '==' as the operator for equality in queries. '=' is not valid here.
Fill both blanks to create a query that filters documents where 'age' is greater than 18 and orders by 'age'.
const adultQuery = firestore.collection('users').where('age', '[1]', 18).[2]('age');
The 'where' clause uses '>' to filter ages greater than 18, and 'orderBy' sorts the results by age.
Fill all three blanks to create a query that filters documents where 'score' is at least 50, orders by 'score', and limits results to 5.
const topScores = firestore.collection('games').where('score', '[1]', 50).[2]('score').[3](5);
The query filters scores greater or equal to 50 using '>='. It orders by 'score' and limits results to 5 documents.