Skip to content

Commit 4ca732e

Browse files
committed
feat(database): add index for user device fetch optimization
- Add 'userId_index' to push_notification_devices collection - Optimize fetching all devices for a specific user - Enhance device cleanup flow on the client
1 parent 8e0b504 commit 4ca732e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/src/services/database_seeding_service.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ class DatabaseSeedingService {
248248
'unique': true,
249249
'sparse': true,
250250
},
251+
{
252+
// Optimizes fetching all devices for a specific user, which is
253+
// needed for the device cleanup flow on the client.
254+
'key': {'userId': 1},
255+
'name': 'userId_index',
256+
},
251257
],
252258
});
253259
_log.info('Ensured indexes for "push_notification_devices".');

0 commit comments

Comments
 (0)