Skip to content

Indexes declared with unique: false, hidden: false or a simple collation are dropped and rebuilt on every startup #469

Closed

Description

@poojagosika

createIndexes compares each declared index with what listIndexes returns. MongoDB leaves some declared options out of the stored index:

  • unique: false
  • hidden: false
  • collation: { locale: 'simple' }

So the declared index never matches the stored one, and it is dropped and rebuilt on every startup. Same family as #420 and #449.

Repro (MongoDB 7):

new Store('things', { schema: {}, indexes: [
  { key: { a: 1 }, unique: false },
  { key: { b: 1 }, collation: { locale: 'simple' } },
] });

The first startup creates both indexes. Every later startup drops and recreates _modelence_a_1 and _modelence_b_1. db.things.getIndexes() shows neither unique nor collation on them.

Tested on main (1ead698).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions