Package com.mongodb
Class Mongo.Holder
java.lang.Object
com.mongodb.Mongo.Holder
- Enclosing class:
Mongo
Deprecated.
Mongo.Holder can be used as a static place to hold several instances of Mongo. Security is not enforced at this level, and needs to
be done on the application side.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconnect
(MongoClientURI uri) Deprecated.Attempts to find an existing MongoClient instance matching that URI in the holder, and returns it if exists.Deprecated.static Mongo.Holder
Deprecated.Get the only instance ofHolder
.
-
Constructor Details
-
Holder
public Holder()Deprecated.
-
-
Method Details
-
singleton
Deprecated.Get the only instance ofHolder
.- Returns:
- the singleton instance of
Holder
-
connect
Deprecated.Please useconnect(MongoClientURI)
instead.Attempts to find an existing MongoClient instance matching that URI in the holder, and returns it if exists. Otherwise creates a new Mongo instance based on this URI and adds it to the holder.- Parameters:
uri
- the Mongo URI- Returns:
- the client
- Throws:
MongoException
- if there's a failure
-
connect
Deprecated.Attempts to find an existing MongoClient instance matching that URI in the holder, and returns it if exists. Otherwise creates a new Mongo instance based on this URI and adds it to the holder.- Parameters:
uri
- the Mongo URI- Returns:
- the client
- Throws:
MongoException
- if there's a failure
-
connect(MongoClientURI)
instead.