Complete the code to create a single-field index on the 'age' field in Firestore.
firestore.collection('users').orderBy('[1]').get()
The 'orderBy' method requires the field name to create an index. Here, 'age' is the correct field.
Complete the code to create a composite index query filtering by 'status' and ordering by 'createdAt'.
firestore.collection('orders').where('status', '==', '[1]').orderBy('createdAt').get()
The 'where' clause filters documents with 'status' equal to 'pending'. This requires a composite index with 'status' and 'createdAt'.
Fix the error in the Firestore query by completing the missing index field.
firestore.collection('products').orderBy('category').orderBy('[1]').get()
When ordering by multiple fields, Firestore requires a composite index. 'price' is commonly used with 'category' for sorting products.
Fill both blanks to create a Firestore query that filters by 'type' and orders by 'timestamp' descending.
firestore.collection('events').where('type', '==', '[1]').orderBy('timestamp', '[2]').get()
The query filters events of type 'conference' and orders them by 'timestamp' in descending order.
Fill all three blanks to create a Firestore query that filters by 'status', orders by 'priority' ascending, and limits results to 10.
firestore.collection('tasks').where('status', '==', '[1]').orderBy('[2]', '[3]').limit(10).get()
This query fetches tasks with status 'in_progress', ordered by 'priority' ascending, limited to 10 results.