com.mongodb
Class Mongo.Holder
java.lang.Object
com.mongodb.Mongo.Holder
- Enclosing class:
- Mongo
public static class Mongo.Holder
- extends Object
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Mongo.Holder
public Mongo.Holder()
connect
public Mongo connect(MongoURI uri)
throws MongoException,
UnknownHostException
- Attempts to find an existing Mongo 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:
-
- Throws:
MongoException
UnknownHostException
singleton
public static Mongo.Holder singleton()