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

Misleading error message on time-series index creation

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • None
    • 5.0.0-rc0
    • Storage
    • None
    • Fully Compatible
    • ALL
    • Execution Team 2021-05-03

    Description

      When attempting to create an index on non-metadata field the server reports:

      > load ('jstests/core/timeseries/timeseries_simple.js')
      ...
       
      > db.timeseries_simple.createIndex({"time":1, "usage_system":1})
      {
      	"ok" : 0,
      	"errmsg" : "BadValue: Invalid index spec for time-series collection: { time: 1.0, usage_system: 1.0 }. Index must be on the 'time' field: usage_system: 1.0 Command request: { createIndexes: \"timeseries_simple\", v: 2, indexes: [ { key: { time: 1.0, usage_system: 1.0 }, name: \"time_1_usage_system_1\" } ], ignoreUnknownIndexOptions: false }",
      	"code" : 67,
      	"codeName" : "CannotCreateIndex"
      }
      

      Attachments

        Activity

          People

            dianna.hohensee@mongodb.com Dianna Hohensee
            ruslan.abdulkhalikov@mongodb.com Ruslan Abdulkhalikov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: