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
Text and 2dsphere indexes are dropped and rebuilt on every startup #449
What happens
Every app start drops and recreates each text and 2dsphere index declared in a Store, even when nothing changed. While a text index is rebuilding, $text queries fail ("text index required for $text query"), and $near/$geoWithin queries fail the same way for 2dsphere. On large collections the rebuild also makes startup slow.
Why isSameIndexDefinition in packages/modelence/src/data/store.ts compares what the code declares with what listIndexes reports, but MongoDB reports these indexes differently:
A text index declared as { title: 'text' } comes back as { _fts: 'text', _ftsx: 1 }, with the fields in weights, so isSameIndexKey never matches.
MongoDB fills in options the code doesn't declare: weights, default_language, language_override and textIndexVersion for text, and 2dsphereIndexVersion for 2dsphere. These are in COMPARABLE_INDEX_OPTION_FIELDS, so isDeepStrictEqual fails.
Activity