private Mono<Void> ensureZones(
            TurmsMongoClient mongoClient,
            List<Pair<String, StorageTierProperties>> tiers,
            String collectionName,
            Zone zone) {
        Mono<Void> ensureZones = Mono.empty();
        Instant creationDateBoundary = LocalDate.now()
                .atStartOfDay()
                .toInstant(ZoneOffset.UTC);
        String creationDateFieldName = zone.creationDateFieldName();
        for (int i = 0, tierSize = tiers.size(); i < tierSize; i++) {
            Pair<String, StorageTierProperties> entry = tiers.get(i);
            String zoneName = entry.first();
            StorageTierProperties properties = entry.second();
            int days = properties.getDays();
            Object max;
            if (i == 0) {
                max = BsonPool.MAX_KEY;
            } else {
                max = new BsonDateTime(creationDateBoundary.toEpochMilli());
                creationDateBoundary = creationDateBoundary.minus(days, ChronoUnit.DAYS);
            }
            Object min = i == tierSize - 1
                    ? BsonPool.MIN_KEY
                    : new BsonDateTime(creationDateBoundary.toEpochMilli());
            List<String> shards = properties.getShards();
            for (String shard : shards) {
                if (!StringUtils.hasText(shard)) {
                    continue;
                }
                ensureZones = ensureZones.then(Mono
                        .defer(() -> mongoClient.addShardToZone(shard, zoneName)
                                .onErrorMap(t -> new RuntimeException(
                                        "Failed to add the shard \""
                                                + shard
                                                + "\" to the zone \""
                                                + zoneName
                                                + "\"",
                                        t)))
                        .doOnSuccess(
                                unused -> LOGGER.info("Added the shard \"{}\" to the zone \"{}\"",
                                        shard,
                                        zoneName)))
                        .then(Mono.defer(() -> {
                            // TODO: support the shard key consisting of multiple fields
                            Document minimum = new Document(creationDateFieldName, min);
                            Document maximum = new Document(creationDateFieldName, max);
                            return mongoClient
                                    .updateZoneKeyRange(collectionName, zoneName, minimum, maximum)
                                    .onErrorMap(t -> new RuntimeException(
                                            "Failed to update the zone \""
                                                    + zoneName
                                                    + "\" with the key range: ["
                                                    + minimum.toJson()
                                                    + ".."
                                                    + maximum.toJson()
                                                    + ")",
                                            t))
                                    .doOnSuccess(unused -> LOGGER.info(
                                            "Updated the zone \"{}\" with the key range: [{}..{})",
                                            zoneName,
                                            minimum.toJson(),
                                            maximum.toJson()));
                        }));
            }
        }
        return ensureZones;
    }
@return True if all collections have existed
turms-service/src/main/java/im/turms/service/storage/mongo/MongoCollectionInitializer.java