createIndexes not working.

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.4.2, 2.5.8, 2.7.0
    • Component/s: None
    • Environment:
      OS: Windows
      Using MongoDB: 8.0.17
      Using Mongosh: 2.7.0
    • None
    • Developer Tools

      If I want to create multiple indices using the createIndexes command, the request always fails, because the command is not sent to the server correctly. Below is a complete mongoshell trace, where I only added a single index for demo purposes:

      Please enter a MongoDB connection string (Default: mongodb://localhost/):
      Current Mongosh Log ID: 69a8326871f09808717c2906
      Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.7.0
      Using MongoDB:          8.0.17
      Using Mongosh:          2.7.0
      For mongosh info see: https://www.mongodb.com/docs/mongodb-shell/
      ------
         The server generated these startup warnings when booting
         2026-03-04T13:59:01.692+01:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
         2026-03-04T13:59:01.692+01:00: This server is bound to localhost. Remote systems will be unable to connect to this server. Start the server with --bind_ip <address> to specify which IP addresses it should serve responses from, or with --bind_ip_all to bind to all interfaces. If this behavior is desired, start the server with --bind_ip 127.0.0.1 to disable this warning
      ------
      dev [direct: primary] test> db.logs_net.createIndexes([
      |   {
      |     key: { correlationIds: 1, timestamp: -1 },
      |     name: 'idx_correlationIds'
      |   }
      | ]);
      MongoServerError[CannotCreateIndex]: Error in specification { name: "key_[object Object]_name_idx_correlationIds", key: { key: { correlationIds: 1, timestamp: -1 }, name: "idx_correlationIds" } } :: caused by :: Unknown index plugin 'idx_correlationIds' 

       

      Running the database command directly is not a problem:

      db.runCommand({
          createIndexes: "logs_net",
          indexes: [{
                  key: {
                      correlationIds: 1,
                      timestamp: -1
                  },
                  name: 'idx_correlationIds'
              }
          ]
      });

       

       

            Assignee:
            Unassigned
            Reporter:
            Stefan Stark
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: