Package org.kiwiproject.mongo
Class MongoClientWrapper
- java.lang.Object
-
- org.kiwiproject.mongo.MongoClientWrapper
-
- All Implemented Interfaces:
Closeable,AutoCloseable
@Beta @Deprecated(forRemoval=true, since="1.2.1") @KiwiDeprecated(since="1.2.1", removeAt="2.0.0", reference="https://github.com/kiwiproject/kiwi/issues/658") public class MongoClientWrapper extends Object implements Closeable
Deprecated, for removal: This API element is subject to removal in a future version.with no replacement since we no longer support the older Mongo 3.x driver versions and our code must therefore use only the new Mongo APIs (i.e.com.mongodb.DBdoesn't exist in the Mongo 4.x drivers).A wrapper around aMongoClientthat also providesMongoDatabaseandDBinstances for a specific database, which is specified in the constructor.
-
-
Constructor Summary
Constructors Constructor Description MongoClientWrapper(String mongoUri, String databaseName)Deprecated, for removal: This API element is subject to removal in a future version.Create a new instance with the given Mongo connection URI.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Deprecated, for removal: This API element is subject to removal in a future version.Closes the wrapperMongoClient.com.mongodb.DBgetDB()Deprecated, for removal: This API element is subject to removal in a future version.Return the (deprecated)DBinstance for clients that have not yet migrated toMongoDatabase.
-
-
-
Constructor Detail
-
MongoClientWrapper
public MongoClientWrapper(String mongoUri, String databaseName)
Deprecated, for removal: This API element is subject to removal in a future version.Create a new instance with the given Mongo connection URI. UsesdatabaseNameto get bothMongoDatabaseandDBinstances, which are available from this instance via their getter methods.- Parameters:
mongoUri- the Mongo connection URIdatabaseName- the database associated with this instance
-
-
Method Detail
-
getDB
public com.mongodb.DB getDB()
Deprecated, for removal: This API element is subject to removal in a future version.Return the (deprecated)DBinstance for clients that have not yet migrated toMongoDatabase.- Returns:
- the DB instance associated with this instance (as specified in the constructor)
-
close
public void close()
Deprecated, for removal: This API element is subject to removal in a future version.Closes the wrapperMongoClient.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-