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

Stricter validation of index key patterns during index creation and startup

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.4.6
    • Fix Version/s: 3.3.1
    • Component/s: Querying
    • Backwards Compatibility:
      Major Change
    • Operating System:
      ALL
    • Sprint:
      Query F (02/01/16)
    • Linked BF Score:
      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

              • Votes:
                0 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: