In production this is fine, validate will just log a message, though ideally the log doesn't talk about expecting a cursor to be present. In our testing environments, the command failure should be handled before escalating to an invariant
[conn69] "Invariant failure","attr":{"expr":"!collStatsResult.getObjectField(\"cursor\").isEmpty() && !collStatsResult.getObjectField(\"cursor\").getObjectField(\"firstBatch\").isEmpty()","msg":"Expected a cursor to be present in the $collStats results: { ok: 0.0, errmsg: \"PlanExecutor error during aggregation :: caused by :: Unable to retrieve count in $collStats stage :: caused by :: Collection [test.capped1] not found.\", code: 26, codeName: \"NamespaceNotFound\", $clusterTime: { clusterTime: Timestamp(1678833862, 262), signature: { hash: BinData(0, 0000000000000000000000000000000000000000), keyId: 0 } }, operationTime: Timestamp(1678833862, 262) }","file":"src/mongo/db/commands/validate.cpp","line":90} [conn69] "\n\n***aborting after invariant() failure\n\n"
- related to
-
SERVER-74632 Log $collStats output when a collection fails validation
- Closed