Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-16516

Investigate changes in SERVER-79514: Make value comparison consistent in MatchExpression

    • 3

      Original Downstream Change Summary

      TLDR: partial indexes with the same index keys and the same partial expressions compared using their collation are not allowed any more.

      Partial filter expression used not to be validated using provided collation as a result, it was possible to create two equivalent indexes:

      db.coll.createIndex({a: 1}, {name: "index0", { locale: "en_US", strength: 1 }, partialFilterExpression: {b: "case"}};
      db.coll.createIndex({a: 1}, {name: "index1",{ locale: "en_US", strength: 1 }, partialFilterExpression: {b: "CASE"}};
      

      However, only the first index index0 will be used to answer queries like

      db.coll.find({a: 1, b: "case"}).collation({ locale: "en_US", strength: 1 });
      db.coll.find({a: 1, b: "CASE"}).collation({ locale: "en_US", strength: 1 });
      db.coll.find({a: 1, b: "Case"}).collation({ locale: "en_US", strength: 1 });
      

      index1 would be never used.

      After the change the second index1 will be prevented from creating with the following error:

      MongoServerError: Index already exists with a different name: index0

      Nothing changed for databases with existing duplicating partial indexes, the indexes will be kept and only the first created index will be used to serve the queries as it was before.

      Description of Linked Ticket

      equivalent() function should compare BSONElements consistently in comparison and $in operators.

            Assignee:
            jason.price@mongodb.com Jason Price
            Reporter:
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              21 weeks, 5 days ago