Package com.mongodb

Class Mongo.Holder

java.lang.Object
com.mongodb.Mongo.Holder
Enclosing class:
Mongo

@Deprecated public static class Mongo.Holder extends Object
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 Details

    • Holder

      public Holder()
      Deprecated.
  • Method Details

    • singleton

      public static Mongo.Holder singleton()
      Deprecated.
      Get the only instance of Holder.
      Returns:
      the singleton instance of Holder
    • connect

      @Deprecated public Mongo connect(MongoURI uri)
      Deprecated.
      Please use connect(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

      public Mongo connect(MongoClientURI uri)
      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