Composite Index Requirements in Firebase
📖 Scenario: You are building a simple app to store and retrieve information about books in a library. Each book has a title, author, and year of publication. You want to be able to quickly find books by author and year together.
🎯 Goal: Create a Firebase Firestore database structure and define a composite index that allows efficient queries filtering by author and year.
📋 What You'll Learn
Create a collection called
books with documents containing fields title, author, and yearAdd a configuration variable called
indexConfig that defines a composite index on author and yearWrite a query that uses the composite index to find books by a specific
author and yearComplete the Firestore index configuration JSON with the correct collection and fields
💡 Why This Matters
🌍 Real World
Composite indexes in Firestore help apps quickly find data when filtering by multiple fields, like searching books by author and year.
💼 Career
Understanding composite indexes is important for database optimization roles and backend development using Firebase.
Progress0 / 4 steps