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

Document new restrictions on index key patterns in 3.4 release notes

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Critical - P2
    • Resolution: Fixed
    • None
    • 3.4.0
    • Server
    • 1
    • KANBAN BUCKET
    • true

    Description

      The values in the index key pattern are 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 now be returned:

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

      > db.mycoll.createIndex({a: 0})
      {
        "ok" : 0,
        "errmsg" : "bad index key pattern { a: 0.0 }: Values in the index key pattern cannot be 0.",
        "code" : 67
      }
      > db.mycoll.createIndex({a: NaN})
      {
        "ok" : 0,
        "errmsg" : "bad index key pattern { a: nan.0 }: Values in the index key pattern cannot be NaN.",
        "code" : 67
      }
      > db.mycoll.createIndex({a: true})
      {
        "ok" : 0,
        "errmsg" : "bad index key pattern { a: true }: Values in index key pattern cannot be of type Bool. Only numbers > 0, numbers < 0, and strings are allowed.",
        "code" : 67
      }
      

      Attachments

        Issue Links

          Activity

            People

              kay.kim@mongodb.com Kay Kim (Inactive)
              max.hirschhorn@mongodb.com Max Hirschhorn
              Luke Bonanomi Luke Bonanomi
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                5 years, 29 weeks, 3 days ago