public class MongoURI extends Object
MongoClientURI
, and the documentation has been moved to that class.Modifier and Type | Field and Description |
---|---|
static String |
MONGODB_PREFIX
The prefix for mongodb URIs.
|
Constructor and Description |
---|
MongoURI(MongoClientURI mongoClientURI)
Deprecated.
Replaced by
MongoClientURI ) |
MongoURI(String uri)
Deprecated.
Replaced by
MongoClientURI.MongoClientURI(String) |
Modifier and Type | Method and Description |
---|---|
Mongo |
connect()
Creates a Mongo instance based on the URI.
|
DBCollection |
connectCollection(DB db)
Returns the URI's Collection from a given DB object.
|
DBCollection |
connectCollection(Mongo mongo)
Returns the URI's Collection from a given Mongo instance
|
DB |
connectDB()
Returns the DB object from a newly created Mongo instance based on this URI.
|
DB |
connectDB(Mongo mongo)
Returns the URI's DB object from a given Mongo instance.
|
String |
getCollection()
Gets the collection name.
|
MongoCredential |
getCredentials()
Gets the credentials.
|
String |
getDatabase()
Gets the database name.
|
List<String> |
getHosts()
Gets the list of hosts.
|
MongoOptions |
getOptions()
Gets the options.
|
char[] |
getPassword()
Gets the password.
|
String |
getUsername()
Gets the username.
|
String |
toString() |
public static final String MONGODB_PREFIX
@Deprecated public MongoURI(String uri)
MongoClientURI.MongoClientURI(String)
uri
- the URI@Deprecated public MongoURI(MongoClientURI mongoClientURI)
MongoClientURI
)MongoClientURI
.mongoClientURI
- the MongoClientURI to wrap with this deprecated class.public String getUsername()
public char[] getPassword()
public String getDatabase()
public String getCollection()
public MongoCredential getCredentials()
public MongoOptions getOptions()
MongoOptions
for every call, so it's possible to mutate the
returned instance to change the defaults.public Mongo connect() throws UnknownHostException
MongoException
UnknownHostException
public DB connectDB() throws UnknownHostException
MongoException
UnknownHostException
public DB connectDB(Mongo mongo)
mongo
- the Mongo instance to get the database from.public DBCollection connectCollection(DB db)
db
- the database to get the collection frompublic DBCollection connectCollection(Mongo mongo)
mongo
- the mongo instance to get the collection from