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

Clarify what occurs when one key is removed from a Compound Index

    XMLWordPrintableJSON

Details

    Description

      If you have a collection that has both a compound index and an index on its prefix (e.g.

      { a: 1, b: 1 }

      and

      { a: 1 }

      ), if neither index has a sparse or unique constraint, then you can remove the index on the prefix (e.g.

      { a: 1 }

      ). MongoDB will use the compound index in all of the situations that it would have used the prefix index.

      if neither "prefix index" has a sparse or unique constraint ? is a valid statement.
      Because if the Compound index has unique constraint does it matters ? still mongodb is not using "prefix index"

      From DOCS-10305

      what if i have unique index on {a,b} but not on {a}}} and I removed {{{a} how will it effect ?

      why it's document neither of them should have unique index ?

      Attachments

        Activity

          People

            Unassigned Unassigned
            xgen-internal-docs Docs Collector User (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              1 year, 14 weeks, 2 days ago