Skip to content

Commit 1e77c0c

Browse files
committed
refactor(database): remove redundant index creations
- Removed indexes for country aggregation queries in headlines collection - Removed index for eventCountry name in headlines collection - Removed index for headquarters aggregation queries in sources collection
1 parent 60b3bcc commit 1e77c0c

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

lib/src/services/database_seeding_service.dart

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -131,32 +131,6 @@ class DatabaseSeedingService {
131131
.collection('countries')
132132
.createIndex(keys: {'name': 1}, name: 'countries_name_index');
133133

134-
/// Indexes for country aggregation queries.
135-
/// This compound index optimizes queries that filter by 'status' and
136-
/// group by 'eventCountry.id' in the headlines collection.
137-
await _db
138-
.collection('headlines')
139-
.createIndex(
140-
keys: {'status': 1, 'eventCountry.id': 1},
141-
name: 'status_eventCountry_index',
142-
);
143-
/// Index for efficient filtering of headlines by the name of the
144-
/// associated event country. This is crucial for the country search
145-
/// functionality when filtering by 'eventCountry' usage.
146-
await _db
147-
.collection('headlines')
148-
.createIndex(
149-
keys: {'eventCountry.name': 1},
150-
name: 'eventCountry_name_index',
151-
);
152-
/// This compound index optimizes queries that filter by 'status' and
153-
/// group by 'headquarters.id' in the sources collection.
154-
await _db
155-
.collection('sources')
156-
.createIndex(
157-
keys: {'status': 1, 'headquarters.id': 1},
158-
name: 'status_headquarters_index',
159-
);
160134

161135
// --- TTL and Unique Indexes via runCommand ---
162136
// The following indexes are created using the generic `runCommand` because

0 commit comments

Comments
 (0)