public interface MongoDatabase
get a MongoCollection .| Modifier and Type | Field and Description |
|---|---|
static String |
ADMIN_NAME
The name of the administration database.
|
static String |
CONFIG_NAME
The name of the configuration database for a sharded configuration.
|
static String |
LOCAL_NAME
The name of the local database.
|
static String |
TEST_NAME
The name of the test database.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
createCappedCollection(String name,
long size)
Creates the capped collection with the specified name and size on the
server.
|
boolean |
createCollection(String name,
DocumentAssignable options)
Creates the collection with the specified name on the server.
|
boolean |
drop()
Drops the database.
|
MongoCollection |
getCollection(String name)
Returns the MongoCollection with the specified name.
|
Durability |
getDurability()
Returns the durability for write operations sent to the server from this
MongoDatabase instance. |
String |
getName()
Returns the name of the database.
|
ProfilingStatus |
getProfilingStatus()
Retrieves the profiling level for the database.
|
ReadPreference |
getReadPreference()
Returns the read preference for queries from this
MongoDatabase
instance. |
List<String> |
listCollectionNames()
Returns the list of the collections contained within the database.
|
List<String> |
listCollections()
Deprecated.
Use the
listCollectionNames() method instead. |
Document |
runAdminCommand(String command)
Runs an administrative command against the 'admin' database.
|
Document |
runAdminCommand(String command,
DocumentAssignable options)
Runs an administrative command against the 'admin' database.
|
Document |
runAdminCommand(String commandName,
String commandValue,
DocumentAssignable options)
Runs an administrative command against the 'admin' database.
|
Document |
runCommand(String command)
Runs a command against the database.
|
Document |
runCommand(String command,
DocumentAssignable options)
Runs a command against the database.
|
Document |
runCommand(String commandName,
int commandValue,
DocumentAssignable options)
Runs a command against the database.
|
Document |
runCommand(String commandName,
String commandValue,
DocumentAssignable options)
Runs a command against the database.
|
void |
runCommandAsync(Callback<Document> reply,
String command)
Runs a command against the database.
|
void |
runCommandAsync(Callback<Document> reply,
String command,
DocumentAssignable options)
Runs a command against the database.
|
void |
runCommandAsync(Callback<Document> reply,
String commandName,
int commandValue,
DocumentAssignable options)
Runs a command against the database.
|
void |
runCommandAsync(Callback<Document> reply,
String commandName,
String commandValue,
DocumentAssignable options)
Runs a command against the database.
|
Future<Document> |
runCommandAsync(String command)
Runs a command against the database.
|
Future<Document> |
runCommandAsync(String command,
DocumentAssignable options)
Runs a command against the database.
|
Future<Document> |
runCommandAsync(String commandName,
int commandValue,
DocumentAssignable options)
Runs a command against the database.
|
Future<Document> |
runCommandAsync(String commandName,
String commandValue,
DocumentAssignable options)
Runs a command against the database.
|
void |
setDurability(Durability durability)
Sets the durability for write operations from this
MongoDatabase
instance. |
boolean |
setProfilingStatus(ProfilingStatus profileLevel)
Sets the profiling level for the database.
|
void |
setReadPreference(ReadPreference readPreference)
Sets the value of the read preference for a queries from this
MongoDatabase instance. |
Document |
stats()
Returns the statistics for the database.
|
static final String ADMIN_NAME
static final String CONFIG_NAME
static final String LOCAL_NAME
static final String TEST_NAME
boolean createCappedCollection(String name, long size) throws MongoDbException
name - The name of the collection.size - The size of the collection in bytes.MongoDbException - On a failure to create the collection.boolean createCollection(String name, DocumentAssignable options) throws MongoDbException
name - The name of the collection.options - The options for the collection being created.MongoDbException - On a failure to create the collection.boolean drop()
throws MongoDbException
MongoDbException - On an error issuing the drop command or in running the
commandMongoCollection getCollection(String name)
name - The name of the collection.MongoCollection.Durability getDurability()
MongoDatabase instance.
Defaults to the Durability from the Mongo's
configuration.
MongoClientConfiguration.getDefaultDurability()String getName()
ProfilingStatus getProfilingStatus() throws MongoDbException
MongoDbException - On a failure to create the collection.ReadPreference getReadPreference()
MongoDatabase
instance.
Defaults to ReadPreference from the Mongo's
configuration.
MongoClientConfiguration.getDefaultReadPreference()List<String> listCollectionNames() throws MongoDbException
MongoDbException - On an error listing the collections.@Deprecated List<String> listCollections() throws MongoDbException
listCollectionNames() method instead.MongoDbException - On an error listing the collections.Document runAdminCommand(String command) throws MongoDbException
command - The name of the command to run.MongoDbException - On an error issuing the command or in running the commandDocument runAdminCommand(String command, DocumentAssignable options) throws MongoDbException
command - The name of the command to run.options - Optional (may be null) options for the command.MongoDbException - On an error issuing the command or in running the commandDocument runAdminCommand(String commandName, String commandValue, DocumentAssignable options) throws MongoDbException
commandName - The name of the command to run.commandValue - The name of the command to run.options - Optional (may be null) options for the command.MongoDbException - On an error issuing the command or in running the commandDocument runCommand(String command) throws MongoDbException
command - The name of the command to run.MongoDbException - On an error issuing the command or in running the commandDocument runCommand(String command, DocumentAssignable options) throws MongoDbException
command - The name of the command to run.options - Optional (may be null) options for the command.MongoDbException - On an error issuing the command or in running the commandDocument runCommand(String commandName, int commandValue, DocumentAssignable options) throws MongoDbException
commandName - The name of the command to run.commandValue - The name of the command to run.options - Optional (may be null) options for the command.MongoDbException - On an error issuing the command or in running the commandDocument runCommand(String commandName, String commandValue, DocumentAssignable options) throws MongoDbException
commandName - The name of the command to run.commandValue - The name of the command to run.options - Optional (may be null) options for the command.MongoDbException - On an error issuing the command or in running the commandvoid runCommandAsync(Callback<Document> reply, String command) throws MongoDbException
reply - Callback that will be notified of the command results.command - The name of the command to run.MongoDbException - On an error issuing the command or in running the commandvoid runCommandAsync(Callback<Document> reply, String command, DocumentAssignable options) throws MongoDbException
reply - Callback that will be notified of the command results.command - The name of the command to run.options - Optional (may be null) options for the command.MongoDbException - On an error issuing the command or in running the commandvoid runCommandAsync(Callback<Document> reply, String commandName, int commandValue, DocumentAssignable options) throws MongoDbException
reply - Callback that will be notified of the command results.commandName - The name of the command to run.commandValue - The name of the command to run.options - Optional (may be null) options for the command.MongoDbException - On an error issuing the command or in running the commandvoid runCommandAsync(Callback<Document> reply, String commandName, String commandValue, DocumentAssignable options) throws MongoDbException
reply - Callback that will be notified of the command results.commandName - The name of the command to run.commandValue - The name of the command to run.options - Optional (may be null) options for the command.MongoDbException - On an error issuing the command or in running the commandFuture<Document> runCommandAsync(String command) throws MongoDbException
command - The name of the command to run.MongoDbException - On an error issuing the command or in running the commandFuture<Document> runCommandAsync(String command, DocumentAssignable options) throws MongoDbException
command - The name of the command to run.options - Optional (may be null) options for the command.MongoDbException - On an error issuing the command or in running the commandFuture<Document> runCommandAsync(String commandName, int commandValue, DocumentAssignable options) throws MongoDbException
commandName - The name of the command to run.commandValue - The name of the command to run.options - Optional (may be null) options for the command.MongoDbException - On an error issuing the command or in running the commandFuture<Document> runCommandAsync(String commandName, String commandValue, DocumentAssignable options) throws MongoDbException
commandName - The name of the command to run.commandValue - The name of the command to run.options - Optional (may be null) options for the command.MongoDbException - On an error issuing the command or in running the commandvoid setDurability(Durability durability)
MongoDatabase
instance.
Defaults to the Durability from the Mongo's configuration
if set to null.
durability - The durability for write operations on the server.MongoClientConfiguration.getDefaultDurability()boolean setProfilingStatus(ProfilingStatus profileLevel) throws MongoDbException
profileLevel - The desired profiling levelfalse.MongoDbException - On a failure to create the collection.void setReadPreference(ReadPreference readPreference)
MongoDatabase instance.
Defaults to the ReadPreference from the Mongo's
configuration if set to null.
readPreference - The read preference for a query.MongoClientConfiguration.getDefaultReadPreference()Document stats() throws MongoDbException
MongoDbException - On an error collecting the database statistics.Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.