public class MongoURI
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MONGODB_PREFIX |
Constructor and Description |
---|
MongoURI(java.lang.String uri)
Creates a MongoURI described by a 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 m)
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 m)
returns the URI's DB object from a given Mongo instance
|
java.lang.String |
getCollection()
Gets the collection name
|
java.lang.String |
getDatabase()
Gets the database name
|
java.util.List<java.lang.String> |
getHosts()
Gets the list of hosts
|
MongoOptions |
getOptions()
Gets the options
|
char[] |
getPassword()
Gets the password
|
java.lang.String |
getUsername()
Gets the username
|
java.lang.String |
toString() |
public static final java.lang.String MONGODB_PREFIX
public MongoURI(java.lang.String uri)
uri
- the URIpublic java.lang.String getUsername()
public char[] getPassword()
public java.util.List<java.lang.String> getHosts()
public java.lang.String getDatabase()
public java.lang.String getCollection()
public MongoOptions getOptions()
public Mongo connect() throws MongoException, java.net.UnknownHostException
MongoException
java.net.UnknownHostException
public DB connectDB() throws MongoException, java.net.UnknownHostException
MongoException
java.net.UnknownHostException
public DB connectDB(Mongo m)
m
- public DBCollection connectCollection(DB db)
db
- public DBCollection connectCollection(Mongo m)
m
- public java.lang.String toString()
toString
in class java.lang.Object