|
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"
|
}
|
|