Package org.kiwiproject.mongo
Class KiwiMongoDbs
- java.lang.Object
-
- org.kiwiproject.mongo.KiwiMongoDbs
-
@Beta public class KiwiMongoDbs extends Object
Static utilities relating to Mongo databases.
-
-
Constructor Summary
Constructors Constructor Description KiwiMongoDbs()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringextractDbName(String mongoUri)Extract the database name component of the given Mongo connection URI.static StringextractDbName(URI uri)Extract the database name component of the given Mongo connection URI.static StringextractHostInformation(String mongoUri)Extract the scheme and host information of the given Mongo connection URI.static StringextractHostInformation(URI uri)Extract the scheme and host information of the given Mongo connection URI.
-
-
-
Method Detail
-
extractDbName
public static String extractDbName(String mongoUri)
Extract the database name component of the given Mongo connection URI.For example,
order_processingis the database name for the URImongodb://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_processingis the database name for the URImongodb://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 URImongodb://mongo-db-1.test:27019/test_database.- Parameters:
mongoUri- the Mongo connection URI- Returns:
- the host information in the format
mongodb://extracted-host-info/
-
-