public class MongoURI extends Object
Modifier and Type | Field and Description |
---|---|
static String |
MONGODB_PREFIX |
Constructor and Description |
---|
MongoURI(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
|
String |
getCollection()
Gets the collection name
|
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
public MongoURI(String uri)
uri
- the URIpublic String getUsername()
public char[] getPassword()
public String getDatabase()
public String getCollection()
public MongoOptions getOptions()
public Mongo connect() throws MongoException, UnknownHostException
MongoException
UnknownHostException
public DB connectDB() throws MongoException, UnknownHostException
MongoException
UnknownHostException
public DB connectDB(Mongo m)
m
- public DBCollection connectCollection(DB db)
db
- public DBCollection connectCollection(Mongo m)
m
-