Currently, if the collection becomes empty after the initial check at the start the calculation of the characteristics about the shard key, and the supporting the index for the shard key is a unique index, the analyzeShardKey would return the following metrics instead of failing with an IllegalOperation error it would in the case where the index is not unique.
{ "numDocs" : NumberLong(0), "isUnique" : true, "numDistinctValues" : NumberLong(0), "mostCommonValues" : [ ], "monotonicity" : { "recordIdCorrelationCoefficient" : 0, "type" : "not monotonic" }, "avgDocSizeBytes" : NumberLong(0), "readDistribution" : { "sampleSize" : { "total" : NumberLong(0), "find" : NumberLong(0), "aggregate" : NumberLong(0), "count" : NumberLong(0), "distinct" : NumberLong(0) } }, "writeDistribution" : { "sampleSize" : { "total" : NumberLong(0), "update" : NumberLong(0), "delete" : NumberLong(0), "findAndModify" : NumberLong(0) } }, "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1686168499, 3549), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1686168499, 3549) }