@Nullable
    private static ShardKey parseShardKey(Class<?> clazz) {
        Sharded sharded = clazz.getAnnotation(Sharded.class);
        if (sharded == null) {
            return null;
        }
        String[] keys = sharded.shardKey();
        if (keys.length == 0) {
            // default shard key
            keys = new String[]{DomainFieldName.ID};
        }
        BsonDocument document;
        if (sharded.shardingStrategy()
                .equals(ShardingStrategy.HASH)) {
            if (keys.length > 1) {
                throw new IllegalArgumentException(
                        "The hash sharding strategy can have only one shard key, "
                                + "but the entity class ("
                                + clazz.getName()
                                + ") has multiple shard keys: "
                                + Arrays.toString(keys));
            } else if (keys[0].equals(DomainFieldName.ID)) {
                throw new IllegalArgumentException(
                        "The entity class ("
                                + clazz.getName()
                                + ") must not create a hashed index on the collection key: \""
                                + DomainFieldName.ID
                                + "\". If so, MongoDB will create a default range index on the key");
            } else {
                document = new BsonDocument(keys[0], BsonPool.BSON_STRING_HASHED);
            }
        } else {
            document = new BsonDocument();
            for (String key : keys) {
                document.append(key, BsonPool.BSON_INT32_1);
            }
        }
        List<ShardKey.Path> paths = new ArrayList<>(2);
        for (String shardKey : document.keySet()) {
            // Note that we split the shard key one level at most (e.g. "_id.whatever")
            // because we don't have other cases currently.
            Pair<String, String> pair = StringUtil.splitLatin1(shardKey, AsciiCode.PERIOD);
            String[] path = pair == null
                    ? new String[]{shardKey}
                    : new String[]{pair.first(), pair.second()};
            paths.add(new ShardKey.Path(shardKey.startsWith(DomainFieldName.ID), shardKey, path));
        }
        return new ShardKey(document, paths);
    }
@implNote The method doesn't the support shard keys that contains a hashed key supported in
          4.4
turms-server-common/src/main/java/im/turms/server/common/storage/mongo/entity/MongoEntityFactory.java