|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mongodb.Mongo
public class Mongo
A database connection with internal pooling. The following are equivalent, and all connect to the local database running on the default port:
Mongo instances have connection pooling built in - see the requestStart and requestDone methods for more information. http://www.mongodb.org/display/DOCS/Java+Driver+ConcurrencyMongo mongo1 = new Mongo( "127.0.0.1" ); Mongo mongo2 = new Mongo( "127.0.0.1", 27017 ); Mongo mongo3 = new Mongo( new DBAddress( "127.0.0.1:27017", "test" ) )
| Field Summary | |
|---|---|
static int |
MAJOR_VERSION
|
static int |
MINOR_VERSION
|
| Constructor Summary | |
|---|---|
Mongo()
|
|
Mongo(DBAddress addr)
Connects to Mongo using a given DBAddress |
|
Mongo(DBAddress left,
DBAddress right)
creates a Mongo connection in paired mode |
|
Mongo(DBAddress left,
DBAddress right,
MongoOptions options)
creates a Mongo connection in paired mode |
|
Mongo(DBAddress addr,
MongoOptions options)
Connects to Mongo using a given DBAddress |
|
Mongo(java.lang.String host)
Connects to the local mongo instance on default port. |
|
Mongo(java.lang.String host,
int port)
Connects to Mongo using a given host, port, and database. |
|
| Method Summary | |
|---|---|
static DB |
connect(DBAddress addr)
|
java.lang.String |
debugString()
|
void |
dropDatabase(java.lang.String dbName)
Drops the database if it exists. |
DBAddress |
getAddress()
Gets the address of this database. |
java.lang.String |
getConnectPoint()
|
java.util.List<java.lang.String> |
getDatabaseNames()
|
DB |
getDB(java.lang.String dbname)
|
java.lang.String |
getVersion()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MAJOR_VERSION
public static final int MINOR_VERSION
| Constructor Detail |
|---|
public Mongo()
throws java.net.UnknownHostException,
MongoException
java.net.UnknownHostException
MongoException
public Mongo(java.lang.String host)
throws java.net.UnknownHostException,
MongoException
host - server to connect to
java.net.UnknownHostException - if the database host cannot be resolved
MongoException
public Mongo(java.lang.String host,
int port)
throws java.net.UnknownHostException,
MongoException
host - the database's host addressport - the port on which the database is running
java.net.UnknownHostException - if the database host cannot be resolved
MongoException
public Mongo(DBAddress addr)
throws MongoException
addr - the database address
MongoExceptionDBAddress
public Mongo(DBAddress addr,
MongoOptions options)
throws MongoException
addr - the database address
MongoExceptionDBAddress
public Mongo(DBAddress left,
DBAddress right)
throws MongoException
left - left side of the pairright - right side of the pair
MongoException
public Mongo(DBAddress left,
DBAddress right,
MongoOptions options)
throws MongoException
left - left side of the pairright - right side of the pair
MongoException| Method Detail |
|---|
public static DB connect(DBAddress addr)
public DB getDB(java.lang.String dbname)
public java.util.List<java.lang.String> getDatabaseNames()
throws MongoException
MongoException
public void dropDatabase(java.lang.String dbName)
throws MongoException
dbName - name of database to drop
MongoExceptionpublic java.lang.String getVersion()
public java.lang.String debugString()
public java.lang.String getConnectPoint()
public DBAddress getAddress()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||