[SERVER-73302] Changed output format in createIndexes Created: 25/Jan/23  Updated: 27/Oct/23  Resolved: 09/Jun/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Dmitry Lukyanov (Inactive) Assignee: Arun Banala
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by RUBY-3216 Wildcard projection spec fails on latest Closed
Related
is related to SERVER-67446 Ensure consistent wildcardProjection ... Closed
Assigned Teams:
Query Execution
Sprint: QE 2023-02-20, QE 2023-03-06, QE 2023-03-20, QE 2023-04-03, QE 2023-04-17
Participants:

 Description   

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?

 



 Comments   
Comment by Kevin Cherkauer [ 09/Jun/23 ]

arun.banala@mongodb.com Confirming bernard.gorman@mongodb.com's answer. The fix to SERVER-67446 did the first suggestion in that ticket's description:

"Persist the user's requested wildcardProjection verbatim and defer normalization until the point where we need to compare index specs."

So you can close the current ticket as working as designed.

Generated at Thu Feb 08 06:24:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.