Package com.mongodb
Class MongoURI
- java.lang.Object
-
- com.mongodb.MongoURI
-
Deprecated.Replaced byMongoClientURI
@Deprecated public class MongoURI extends Object
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 Summary
Fields Modifier and Type Field Description static String
MONGODB_PREFIX
Deprecated.The prefix for mongodb URIs.
-
Constructor Summary
Constructors Constructor Description MongoURI(MongoClientURI proxied)
Deprecated.MongoURI(String uri)
Deprecated.Replaced byMongoClientURI(String)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Mongo
connect()
Deprecated.Creates a Mongo instance based on the URI.DBCollection
connectCollection(DB db)
Deprecated.Returns the URI's Collection from a given DB object.DBCollection
connectCollection(Mongo mongo)
Deprecated.Returns the URI's Collection from a given Mongo instanceDB
connectDB()
Deprecated.Returns the DB object from a newly created Mongo instance based on this URI.DB
connectDB(Mongo mongo)
Deprecated.Returns the URI's DB object from a given Mongo instance.String
getCollection()
Deprecated.Gets the collection name.MongoCredential
getCredentials()
Deprecated.Gets the credentials.String
getDatabase()
Deprecated.Gets the database name.List<String>
getHosts()
Deprecated.Gets the list of hosts.MongoOptions
getOptions()
Deprecated.Gets the options.char[]
getPassword()
Deprecated.Gets the password.String
getUsername()
Deprecated.Gets the username.String
toString()
Deprecated.
-
-
-
Field Detail
-
MONGODB_PREFIX
public static final String MONGODB_PREFIX
Deprecated.The prefix for mongodb URIs.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MongoURI
@Deprecated public MongoURI(String uri)
Deprecated. Replaced byMongoClientURI(String)
Creates a MongoURI from a string.- Parameters:
uri
- the URI- MongoDB documentation
- Connection String URI Format
-
MongoURI
@Deprecated public MongoURI(MongoClientURI proxied)
Deprecated.Create a new MongoURI from a MongoClientURI. This class is deprecated, useMongoClientURI
.- Parameters:
proxied
- the MongoClientURI to wrap with this deprecated class. * @deprecated Replaced byMongoClientURI
)
-
-
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 ofMongoOptions
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
-
-