private Mono<SharedClusterProperties> findAndUpdatePropertiesByNodeType(
            SharedClusterProperties clusterProperties) {
        Filter filter = Filter.newBuilder(2)
                .eq(DomainFieldName.ID, clusterId);
        return sharedConfigService.findOne(SharedClusterProperties.class, filter)
                .flatMap(properties -> switch (nodeType) {
                    case AI_SERVING -> {
                        if (properties.getAiServingProperties() != null) {
                            yield Mono.just(properties);
                        }
                        filter.eq(SharedClusterProperties.Fields.aiServingProperties, null);
                        Update update = Update.newBuilder(1)
                                .set(SharedClusterProperties.Fields.aiServingProperties,
                                        clusterProperties.getAiServingProperties());
                        yield sharedConfigService
                                .updateOne(SharedClusterProperties.class, filter, update)
                                .map(result -> {
                                    if (result.getModifiedCount() == 0) {
                                        throw new RuntimeException(
                                                "Failed to update the cluster properties");
                                    }
                                    properties.setAiServingProperties(
                                            clusterProperties.getAiServingProperties());
                                    return properties;
                                });
                    }
                    case GATEWAY -> {
                        if (properties.getGatewayProperties() != null) {
                            yield Mono.just(properties);
                        }
                        filter.eq(SharedClusterProperties.Fields.gatewayProperties, null);
                        Update update = Update.newBuilder(1)
                                .set(SharedClusterProperties.Fields.gatewayProperties,
                                        clusterProperties.getGatewayProperties());
                        yield sharedConfigService
                                .updateOne(SharedClusterProperties.class, filter, update)
                                .map(result -> {
                                    if (result.getModifiedCount() == 0) {
                                        throw new RuntimeException(
                                                "Failed to update the cluster properties");
                                    }
                                    properties.setGatewayProperties(
                                            clusterProperties.getGatewayProperties());
                                    return properties;
                                });
                    }
                    case SERVICE -> {
                        if (properties.getServiceProperties() != null) {
                            yield Mono.just(properties);
                        }
                        filter.eq(SharedClusterProperties.Fields.serviceProperties, null);
                        Update update = Update.newBuilder(1)
                                .set(SharedClusterProperties.Fields.serviceProperties,
                                        clusterProperties.getServiceProperties());
                        yield sharedConfigService
                                .updateOne(SharedClusterProperties.class, filter, update)
                                .map(result -> {
                                    if (result.getModifiedCount() == 0) {
                                        throw new RuntimeException(
                                                "Failed to update the cluster properties");
                                    }
                                    properties.setServiceProperties(
                                            clusterProperties.getServiceProperties());
                                    return properties;
                                });
                    }
                    case MOCK -> {
                        if (properties.getMockNodeProperties() != null) {
                            yield Mono.just(properties);
                        }
                        filter.eq(SharedClusterProperties.Fields.mockNodeProperties, null);
                        Update update = Update.newBuilder(1)
                                .set(SharedClusterProperties.Fields.mockNodeProperties,
                                        clusterProperties.getMockNodeProperties());
                        yield sharedConfigService
                                .updateOne(SharedClusterProperties.class, filter, update)
                                .map(result -> {
                                    if (result.getModifiedCount() == 0) {
                                        throw new RuntimeException(
                                                "Failed to update the cluster properties");
                                    }
                                    properties.setMockNodeProperties(
                                            clusterProperties.getMockNodeProperties());
                                    return properties;
                                });
                    }
                });
    }
@implNote We don't support the partial update by {@link java.util.Map} because there is not
          an efficient way to update nested objects of a document in MongoDB.
turms-server-common/src/main/java/im/turms/server/common/infra/cluster/service/config/SharedPropertyService.java