Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-11064

Stricter validation of index key patterns during index creation and startup

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.4.6
    • 3.3.1
    • Querying
    • Major Change
    • ALL
    • Query F (02/01/16)
    • 0

    Description

      The values in the index key pattern will be restricted to

      • numbers > 0 (ascending)
      • numbers < 0 (descending)
      • strings (special index types)

      Some specific values that may be of interest for which an error will be returned under the new scheme:

      • 0
      • NaN
      • undefined and null
      • true and false
      • MinKey and MaxKey

      Original description

      ensureIndex permits any numeric value to be passed as the sort order. Negative values indicate descending order, greater than or equal to zero indicate ascending.

      We should just limit to 1 and -1.

      This was partially fixed with SERVER-5826, but only applies to non-numeric values.

      Attachments

        1. server11064.js
          1 kB
        2. server11064.patch
          0.8 kB

        Issue Links

          Activity

            People

              max.hirschhorn@mongodb.com Max Hirschhorn
              oleg@evergage.com Oleg Rekutin
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: