[SERVER-36804] No "executionStats" with explain mode for aggregate Created: 22/Aug/18  Updated: 23/Sep/18  Resolved: 26/Aug/18

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

Type: Bug Priority: Major - P3
Reporter: dorothee Assignee: Nick Brewer
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

As describe here https://jira.mongodb.org/browse/SERVER-19758, the functionnality  "executionStats" with explain has been added since Mongo version 3.5.5.

With Mongo version 4.0.1, "executionStats" is not returned with explain mode.

 db.version();
 db.c.drop();
 for (let i = 0; i < 10; i++) { db.c.insert({_id: i, a: 1, b: i}); }
  
 db.c.createIndex({a: 1});
 db.c.createIndex({b: 1});
 
 /* method 1 */ 
 db.c.explain("executionStats").aggregate([{$match: {a: 1, b: {$gt: 3}}}]);
 
 /* method 2 */ 
 db.c.aggregate(
  [{$match: {a: 1, b: {$gt: 3}}}],
  { explain: true }
)

Result method 1 :
 

{
    "stages" : [ 
        {
            "$cursor" : {
                "query" : {
                    "a" : 1.0,
                    "b" : {
                        "$gt" : 3.0
                    }
                },
                "queryPlanner" : {
                    "plannerVersion" : 1,
                    "namespace" : "test.c",
                    "indexFilterSet" : false,
                    "parsedQuery" : {
                        "$and" : [ 
                            {
                                "a" : {
                                    "$eq" : 1.0
                                }
                            }, 
                            {
                                "b" : {
                                    "$gt" : 3.0
                                }
                            }
                        ]
                    },
                    "winningPlan" : {
                        "stage" : "CACHED_PLAN",
                        "inputStage" : {
                            "stage" : "FETCH",
                            "filter" : {
                                "a" : {
                                    "$eq" : 1.0
                                }
                            },
                            "inputStage" : {
                                "stage" : "IXSCAN",
                                "keyPattern" : {
                                    "b" : 1.0
                                },
                                "indexName" : "b_1",
                                "isMultiKey" : false,
                                "multiKeyPaths" : {
                                    "b" : []
                                },
                                "isUnique" : false,
                                "isSparse" : false,
                                "isPartial" : false,
                                "indexVersion" : 1,
                                "direction" : "forward",
                                "indexBounds" : {
                                    "b" : [ 
                                        "(3.0, inf.0]"
                                    ]
                                }
                            }
                        }
                    },
                    "rejectedPlans" : []
                }
            }
        }
    ],
    "ok" : 1.0
}



 Comments   
Comment by dorothee [ 27/Aug/18 ]

Thanks. Unfortunately, I use the latest version of Robo3T 1.2 for windows. As you suggest, my last chance is to ask them.

Comment by Nick Brewer [ 26/Aug/18 ]

dorothee According to the Robo3T Github it embeds mongo shell version 3.4. However, you may have better luck asking this question within the Robo3T community. Since this doesn't demonstrate in MongoDB, I'll close this ticket. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag.

-Nick

Comment by dorothee [ 24/Aug/18 ]

Thanks for your answer. You're right. It's probably due to the shell version, used by my client tool Robo3T.

I did a test directly in command line on Mongo Server (MongoDB server version: 4.0.1,MongoDB shell version v4.0.1) where engine version and shell version are aligned

The output of the command :

 

db.c.explain("executionStats").aggregate([{$match: {a: 1, b: {$gt: 3}}}]);

 

returns "executionStats" attibute as expected.

A question in pending for me : how to know and change the mongo shell version used by Robo3T if it's possible.

Dorothée

 

Comment by Nick Brewer [ 22/Aug/18 ]

dorothee I believe the issue here is that you're likely using an older driver, or an older version of the mongo shell. Could you try upgrading to the latest stable version of your driver / shell, and let us know if this resolves the issue?

-Nick

Generated at Thu Feb 08 04:44:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.