Package com.mongodb

Class MongoURI


  • @Deprecated
    public class MongoURI
    extends Object
    Deprecated.
    Replaced by MongoClientURI

    Represents a URI which can be used to create a Mongo instance. The URI describes the hosts to be used and options.

    This class has been superseded by MongoClientURI, and may be removed in a future release.

    See Also:
    MongoClientURI
    • Field Detail

    • Method Detail

      • getUsername

        @Nullable
        public String getUsername()
        Deprecated.
        Gets the username.
        Returns:
        the username
      • getPassword

        @Nullable
        public char[] getPassword()
        Deprecated.
        Gets the password.
        Returns:
        the password
      • getHosts

        public List<String> getHosts()
        Deprecated.
        Gets the list of hosts.
        Returns:
        the list of hosts
      • getDatabase

        @Nullable
        public String getDatabase()
        Deprecated.
        Gets the database name.
        Returns:
        the database name
      • getCollection

        @Nullable
        public String getCollection()
        Deprecated.
        Gets the collection name.
        Returns:
        the collection name
      • getCredentials

        @Nullable
        public MongoCredential getCredentials()
        Deprecated.
        Gets the credentials.
        Returns:
        the MongoCredential for conneting to MongoDB servers.
        Since:
        2.11.0
      • getOptions

        public MongoOptions getOptions()
        Deprecated.
        Gets the options. This method will return the same instance of MongoOptions for every call, so it's possible to mutate the returned instance to change the defaults.
        Returns:
        the mongo options
      • connect

        public Mongo connect()
        Deprecated.
        Creates a Mongo instance based on the URI.
        Returns:
        a new Mongo instance. There is no caching, so each call will create a new instance, each of which must be closed manually.
        Throws:
        MongoException - if there's a failure
      • connectDB

        public DB connectDB()
        Deprecated.
        Returns the DB object from a newly created Mongo instance based on this URI.
        Returns:
        the database specified in the URI. This will implicitly create a new Mongo instance, which must be closed manually.
        Throws:
        MongoException - if there's a failure
      • connectDB

        public DB connectDB(Mongo mongo)
        Deprecated.
        Returns the URI's DB object from a given Mongo instance.
        Parameters:
        mongo - the Mongo instance to get the database from.
        Returns:
        the database specified in this URI
      • connectCollection

        public DBCollection connectCollection(DB db)
        Deprecated.
        Returns the URI's Collection from a given DB object.
        Parameters:
        db - the database to get the collection from
        Returns:
        the collection specified in this URI
      • connectCollection

        public DBCollection connectCollection(Mongo mongo)
        Deprecated.
        Returns the URI's Collection from a given Mongo instance
        Parameters:
        mongo - the mongo instance to get the collection from
        Returns:
        the collection specified in this URI