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

Stricter validation of index key patterns during index creation and startup

    • Major Change
    • ALL
    • Query F (02/01/16)
    • 0

      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.

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

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

              Created:
              Updated:
              Resolved: