void
|
addOption(int option)
Adds the give option
|
WriteResult
|
addUser(String username, char[] passwd, boolean readOnly)
Adds a new user for this db
|
WriteResult
|
addUser(String username, char[] passwd)
Adds a new user for this db
|
boolean
|
authenticate(String username, char[] passwd)
Authenticates to db with the given name and password
|
CommandResult
|
authenticateCommand(String username, char[] passwd)
Authenticates to db with the given name and password
|
abstract
void
|
cleanCursors(boolean force)
|
boolean
|
collectionExists(String collectionName)
Checks to see if a collection by name %lt;name> exists.
|
CommandResult
|
command(String cmd)
Executes a database command.
|
CommandResult
|
command(DBObject cmd, int options, ReadPreference readPrefs)
|
CommandResult
|
command(DBObject cmd, int options, ReadPreference readPrefs, DBEncoder encoder)
Executes a database command.
|
CommandResult
|
command(String cmd, int options)
Executes a database command.
|
CommandResult
|
command(DBObject cmd)
Executes a database command.
|
CommandResult
|
command(DBObject cmd, int options, DBEncoder encoder)
|
CommandResult
|
command(DBObject cmd, DBEncoder encoder)
|
CommandResult
|
command(DBObject cmd, int options)
Executes a database command.
|
DBCollection
|
createCollection(String name, DBObject options)
Creates a collection with a given name and options.
|
CommandResult
|
doEval(String code, Object... args)
evaluates a function on the database.
|
abstract
DBCollection
|
doGetCollection(String name)
Returns the collection represented by the string <dbName>.<collectionName>.
|
void
|
dropDatabase()
Drops this database.
|
Object
|
eval(String code, Object... args)
|
void
|
forceError()
For testing purposes only - this method forces an error to help test error handling
|
DBCollection
|
getCollection(String name)
Gets a collection with a given name.
|
DBCollection
|
getCollectionFromString(String s)
Returns a collection matching a given string.
|
Set<String>
|
getCollectionNames()
Returns a set containing the names of all collections in this database.
|
CommandResult
|
getLastError(int w, int wtimeout, boolean fsync)
|
CommandResult
|
getLastError(WriteConcern concern)
@return
|
CommandResult
|
getLastError()
Gets the the error (if there is one) from the previous operation on this connection.
|
Mongo
|
getMongo()
Gets the Mongo instance
|
String
|
getName()
Returns the name of this database.
|
int
|
getOptions()
Gets the query options
|
CommandResult
|
getPreviousError()
Returns the last error that occurred since start of database or a call to resetError()
The return object will look like
{ err : errorMessage, nPrev : countOpsBack, ok : 1 }
The value for errorMessage will be null of no error has occurred, otherwise the error message.
|
ReadPreference
|
getReadPreference()
Gets the default read preference
|
DB
|
getSisterDB(String name)
Gets another database on same server
|
CommandResult
|
getStats()
Returns the result of "dbstats" command
|
WriteConcern
|
getWriteConcern()
Gets the write concern for this database.
|
boolean
|
isAuthenticated()
Returns true if a user has been authenticated
|
WriteResult
|
removeUser(String username)
Removes a user for this db
|
abstract
void
|
requestDone()
ends the current "consistent request"
|
abstract
void
|
requestEnsureConnection()
ensure that a connection is assigned to the current "consistent request" (from primary pool, if connected to a replica set)
|
abstract
void
|
requestStart()
starts a new "consistent request".
|
void
|
resetError()
Resets the error memory for this database.
|
void
|
resetOptions()
Resets the query options
|
void
|
setOptions(int options)
Sets the query options
|
void
|
setReadOnly(Boolean b)
Makes this database read-only.
|
void
|
setReadPreference(ReadPreference preference)
Sets the read preference for this database.
|
void
|
setWriteConcern(WriteConcern concern)
Sets the write concern for this database.
|
void
|
slaveOk()
This method is deprecated.
Replaced with ReadPreference.SECONDARY
|
String
|
toString()
Returns the name of this database.
|