com.mongodb
Class DBApiLayer
java.lang.Object
com.mongodb.DB
com.mongodb.DBApiLayer
public class DBApiLayer
- extends DB
Database API
This cannot be directly instantiated, but the functions are available
through instances of Mongo.
Method Summary |
void |
cleanCursors(boolean force)
|
protected com.mongodb.DBApiLayer.MyCollection |
doGetCollection(String name)
Returns the collection represented by the string <dbName>.<collectionName>. |
void |
requestDone()
ends the current "consistent request" |
void |
requestEnsureConnection()
ensure that a connection is assigned to the current "consistent request" (from primary pool, if connected to a replica set) |
void |
requestStart()
starts a new "consistent request". |
Methods inherited from class com.mongodb.DB |
addOption, addUser, addUser, authenticate, authenticateCommand, collectionExists, command, command, command, command, command, command, command, command, createCollection, doEval, dropDatabase, eval, forceError, getCollection, getCollectionFromString, getCollectionNames, getLastError, getLastError, getLastError, getMongo, getName, getOptions, getPreviousError, getReadPreference, getSisterDB, getStats, getWriteConcern, isAuthenticated, removeUser, resetError, resetOptions, setOptions, setReadOnly, setReadPreference, setWriteConcern, slaveOk, toString |
DBApiLayer
protected DBApiLayer(Mongo mongo,
String name,
DBConnector connector)
- Parameters:
mongo
- the Mongo instancename
- the database nameconnector
- the connector
DBApiLayer
protected DBApiLayer(Mongo mongo,
String name,
DBTCPConnector connector,
String username,
char[] password)
- Parameters:
mongo
- the Mongo instancename
- the database nameconnector
- the connectorusername
- username to authenticate database againstpassword
- password to authenticate database against
requestStart
public void requestStart()
- Description copied from class:
DB
- starts a new "consistent request".
Following this call and until requestDone() is called, all db operations should use the same underlying connection.
This is useful to ensure that operations happen in a certain order with predictable results.
- Specified by:
requestStart
in class DB
requestDone
public void requestDone()
- Description copied from class:
DB
- ends the current "consistent request"
- Specified by:
requestDone
in class DB
requestEnsureConnection
public void requestEnsureConnection()
- Description copied from class:
DB
- ensure that a connection is assigned to the current "consistent request" (from primary pool, if connected to a replica set)
- Specified by:
requestEnsureConnection
in class DB
doGetCollection
protected com.mongodb.DBApiLayer.MyCollection doGetCollection(String name)
- Description copied from class:
DB
- Returns the collection represented by the string <dbName>.<collectionName>.
- Specified by:
doGetCollection
in class DB
- Parameters:
name
- the name of the collection
- Returns:
- the collection
cleanCursors
public void cleanCursors(boolean force)
- Specified by:
cleanCursors
in class DB
- Parameters:
force
- true if should clean regardless of number of dead cursors
- Throws:
MongoException