Collections
Collections are logical groupings of documents:Why Indexes Are Required
Without indexes:Index Types
Hash Index
Best for equality lookups (e.g.,WHERE email = 'user@example.com'):
BTree Index
Best for range queries and sorting (e.g.,WHERE createdAt > '2024-01-01'):
Price Index
Special type for value-based payment models. See PriceIndex for details.When to Create Indexes
1
Before storing data
Create indexes BEFORE storing any data to ensure optimal performance from the start
2
Query fields
Index all fields used in
whereField() queries3
Foreign keys
Index foreign key fields used in relations and JOINs
4
Sort fields
Index fields used for sorting
Complete Example
Relations Between Collections
Create relations for better data organization:Next Steps
Data Storage
Store data with payment callbacks
Querying
Query your indexed collections