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

Changed output format in createIndexes

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Execution
    • QE 2023-02-20, QE 2023-03-06, QE 2023-03-20, QE 2023-04-03, QE 2023-04-17

      The latest server release has changed what output is generated in createIndexes command:

      In previous releases (for example in 5.0.2) fields in output used a format with "boolean flag" like: `"_id" : true`. See wildcardProjection node:

       

      MongoDB Enterprise replset:PRIMARY> db.runCommand({ "createIndexes" : "test_wildcard_index", "indexes" : [{ "key" : { "$**" : 1 }, "name" : "custom", "wildcardProjection" : { "b" : 1, "_id" : 0 } }] })
      {
              "numIndexesBefore" : 1,
              "numIndexesAfter" : 2,
              "createdCollectionAutomatically" : true,
              "commitQuorum" : "votingMembers",
              "ok" : 1,
              "$clusterTime" : {
                      "clusterTime" : Timestamp(1674661581, 2),
                      "signature" : {
                              "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                              "keyId" : NumberLong(0)
                      }
              },
              "operationTime" : Timestamp(1674661581, 2)
      }
      MongoDB Enterprise replset:PRIMARY> db.test_wildcard_index.getIndexes()
      [
              {
                      "v" : 2,
                      "key" : {
                              "_id" : 1
                      },
                      "name" : "_id_"
              },
              {
                      "v" : 2,
                      "key" : {
                              "$**" : 1
                      },
                      "name" : "custom",
                      "wildcardProjection" : {
                              "b" : true,
                              "_id" : false
                      }
              }
      ] 

      but in the recently released version the output uses a format with "a number flag" like `"_id" : 0`.  See wildcardProjection node in output for 6.3.0-alpha-1336-gd798eac server:

       

       

      MongoDB Enterprise replset:PRIMARY> db.runCommand({ "createIndexes" : "test_wildcard_index", "indexes" : [{ "key" : { "$**" : 1 }, "name" : "custom", "wildcardProjection" : { "b" : 1, "_id" : 0 } }] })
      {
              "numIndexesBefore" : 1,
              "numIndexesAfter" : 2,
              "createdCollectionAutomatically" : true,
              "commitQuorum" : "votingMembers",
              "ok" : 1,
              "$clusterTime" : {
                      "clusterTime" : Timestamp(1674660265, 2),
                      "signature" : {
                              "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                              "keyId" : NumberLong(0)
                      }
              },
              "operationTime" : Timestamp(1674660265, 2)
      }
      MongoDB Enterprise replset:PRIMARY> db.test_wildcard_index.getIndexes()
      [
              {
                      "v" : 2,
                      "key" : {
                              "_id" : 1
                      },
                      "name" : "_id_"
              },
              {
                      "v" : 2,
                      "key" : {
                              "$**" : 1
                      },
                      "name" : "custom",
                      "wildcardProjection" : {
                              "b" : 1,
                              "_id" : 0
                      }
              }
      ] 

      As I recall, the newly added format (with a number flag) was used in servers before 4.5 and then was replaced on a format with boolean flag. So now the previous format got back? Can someone clarify it?

       

            Assignee:
            arun.banala@mongodb.com Arun Banala
            Reporter:
            dmitry.lukyanov@mongodb.com Dmitry Lukyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: