com.mongodb
Class DBApiLayer

java.lang.Object
  extended by com.mongodb.DB
      extended by com.mongodb.DBApiLayer

public class DBApiLayer
extends DB

Database API This cannot be directly instantiated, but the functions are available through instances of Mongo.


Field Summary
 
Fields inherited from class com.mongodb.DB
_readOnly
 
Constructor Summary
protected DBApiLayer(Mongo mongo, String name, DBConnector connector)
           
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DBApiLayer

protected DBApiLayer(Mongo mongo,
                     String name,
                     DBConnector connector)
Parameters:
mongo - the Mongo instance
name - the database name
connector - the connector
Method Detail

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