Class KiwiMongoDbs


  • @Beta
    public class KiwiMongoDbs
    extends Object
    Static utilities relating to Mongo databases.
    • Constructor Detail

      • KiwiMongoDbs

        public KiwiMongoDbs()
    • Method Detail

      • extractDbName

        public static String extractDbName​(String mongoUri)
        Extract the database name component of the given Mongo connection URI.

        For example, order_processing is the database name for the URI mongodb://database-1.test/order_processing.

        Parameters:
        mongoUri - the Mongo connection URI, assumed to contain the database name
        Returns:
        the database name
        Throws:
        IllegalArgumentException - if the given Mongo URI does not contain a database
      • extractDbName

        public static String extractDbName​(URI uri)
        Extract the database name component of the given Mongo connection URI.

        For example, order_processing is the database name for the URI mongodb://database-1.test/order_processing.

        Parameters:
        uri - the Mongo connection URI, assumed to contain the database name
        Returns:
        the database name
        Throws:
        IllegalArgumentException - if the given Mongo URI does not contain a database
      • extractHostInformation

        public static String extractHostInformation​(String mongoUri)
        Extract the scheme and host information of the given Mongo connection URI.

        For example, mongodb://mongo-db-1.test:27019/ is the host component for the URI mongodb://mongo-db-1.test:27019/test_database.

        Parameters:
        mongoUri - the Mongo connection URI
        Returns:
        the host information in the format mongodb://extracted-host-info/
      • extractHostInformation

        public static String extractHostInformation​(URI uri)
        Extract the scheme and host information of the given Mongo connection URI.
        Parameters:
        uri - the Mongo connection URI
        Returns:
        the host information in the format mongodb://extracted-host-info/