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

Investigate changes in SERVER-47659: Add 'wildcardProjection' parameter to index signature

      Description

      Downstream Change Summary

      The wildcardProjection index option is now part of the index signature test unlike v4.4. To achieve this behavior, we're normalizing wildcardProjection option if it's not empty before creating an {"$**": 1} wildcard index.

      For example, {"$**": 1} {wildcardProjection: {a: 1}} is normalized to {"$**": 1} {wildcardProjection: {a: true, _id: false}}, which may be visibly different from what a user exactly specified.

      Description of Linked Ticket

      At present, an index's signature - that is, the combination of parameters which uniquely identify the index - is defined by its keypattern and collation. No index can be created if its signature is equivalent to an existing index. SERVER-25023 seeks to add the partialFilterExpression parameter to this list, such that multiple partial indexes could be built on the same fields so long as their filters are different.

      We should also add the wildcardProjection parameter to the index signature. At present, we allow any number of wildcard indexes to be built using the {"field.path.$**": 1} notation, but we do not allow multiple wildcard indexes with different projections to exist. It is therefore legal to do this:

      db.coll.createIndex({"a.$**": 1})
      db.coll.createIndex({"b.$**": 1})
      

      ... but illegal to do the following, even though the indexes should be functionally identical to the above:

      db.coll.createIndex({"$**": 1}, {wildcardProjection: {a: 1}})
      db.coll.createIndex({"$**": 1}, {wildcardProjection: {b: 1}})
      

      More significantly, the former syntax is limited to inclusion of a single path; permitting the latter would be far more powerful in allowing the user to create separate wildcard indexes to index different sections of their dataset.

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

            Assignee:
            ian.fogelman@mongodb.com Ian Fogelman
            Reporter:
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              2 years, 21 weeks, 3 days ago