Package org.kiwiproject.mongo
Class KiwiMongoDbs
java.lang.Object
org.kiwiproject.mongo.KiwiMongoDbs
Static utilities relating to Mongo databases.
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 StringExtract the scheme and host information of the given Mongo connection URI.
-
Method Details
-
extractDbName
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
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
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/
-
extractHostInformation
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/
-