Complete the code to create a collection group query for all 'messages' collections.
const query = firestore.collectionGroup('[1]');
The collectionGroup method queries all collections with the given name, here 'messages'.
Complete the code to add a filter where the 'status' field equals 'active' in the collection group query.
const activeMessages = firestore.collectionGroup('messages').where('status', '==', [1]);
The where clause filters documents where the 'status' field is exactly 'active'.
Fix the error in the code by completing the method to get the query results.
const snapshot = await firestore.collectionGroup('messages').[1]();
The get() method fetches the documents matching the query.
Fill both blanks to create a query that orders messages by 'timestamp' descending and limits to 10 results.
const recentMessages = firestore.collectionGroup('messages').orderBy('[1]', '[2]').limit(10);
Ordering by 'timestamp' descending shows newest messages first. The limit(10) restricts results to 10.
Fill all three blanks to create a query that filters messages with 'read' equal to false, orders by 'timestamp' ascending, and limits to 5 results.
const unreadMessages = firestore.collectionGroup('[1]').where('[2]', '==', [3]).orderBy('timestamp', 'asc').limit(5);
This query targets the 'messages' collection group, filters for unread messages where 'read' is false, orders by 'timestamp' ascending, and limits to 5 results.