[SERVER-75861] Unify behavior between mongod and mongos when running $planCacheStats on a nonexistent database Created: 07/Apr/23  Updated: 05/Feb/24

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

Type: Task Priority: Major - P3
Reporter: Kyle Suarez Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: pm3278-m1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Participants:

 Description   

On mongod, running a $planCacheStats aggregation on a nonexistent database returns an error. On mongos it does not error.

The goal of this ticket is to unify the behavior, presumably to make mongod match mongos and not error.



 Comments   
Comment by Mickey Winters [ 06/Dec/23 ]

similar to https://jira.mongodb.org/browse/SERVER-75859 when the db exists behavior is unified but when the db doesn't exist then behavior is divergent

Comment by Kyle Suarez [ 11/Apr/23 ]

Actually, this might be done already. Seems like the two behaviors are unified where they both error? Here is against a mongos:

mongos> db.collection.aggregate({$planCacheStats: {}})
mongos> db.sdfsdf.aggregate({$planCacheStats: {}})
uncaught exception: Error: command failed: {
        "ok" : 0,
        "errmsg" : "PlanExecutor error during aggregation :: caused by :: collection 'test.sdfsdf' does not exist",
        "code" : 50933,
        "codeName" : "Location50933",
        "$clusterTime" : {
                "clusterTime" : Timestamp(1681156906, 1),
                "signature" : {
                        "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                        "keyId" : NumberLong(0)
                }
        },

And here is a mongod:

> db.nonexistent.aggregate({$planCacheStats: {}})
uncaught exception: Error: command failed: {
        "ok" : 0,
        "errmsg" : "PlanExecutor error during aggregation :: caused by :: collection 'test.nonexistent' does not exist",
        "code" : 50933,
        "codeName" : "Location50933"
}

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