You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Collation indexes (incl. users handle/email) are dropped and rebuilt on every startup #420
On every app startup, createIndexes drops and recreates any index declared with a collation, even when nothing changed. This includes the built-in unique users indexes on handle and emails.address (src/auth/db.ts).
Why
MongoDB's listIndexes reports a collation fully expanded, with every option plus the ICU version:
The code declares only { locale: 'en', strength: 2 }. isSameIndexDefinition in src/data/store.ts deep-compares the two, so they never match and the index is treated as changed.
Impact
With the default background creation mode, the drop runs under the lock and the rebuild runs later in the background. Until it finishes:
nothing enforces case-insensitive handle/email uniqueness (the signup race the emails.address index exists to prevent);
collation lookups fall back to collection scans;
if a duplicate slips in, the rebuild fails and is only logged as a warning.
How to check
Run db.users.getIndexes() on any existing app: the _modelence_handle_1 and _modelence_emails.address_1 collations come back expanded, and the indexes are recreated on each restart.
Fix
PR #419 compares only the collation fields the index declares, with a regression test that fails on main.
Activity