public class DropDatabaseOperation extends java.lang.Object implements AsyncWriteOperation<java.lang.Void>, WriteOperation<java.lang.Void>
execute
method throws MongoCommandFailureException if something goes wrong, but
it will not throw an Exception if the collection does not exist before trying to drop it.Modifier and Type | Field and Description |
---|---|
private java.lang.String |
databaseName |
private static BsonDocument |
DROP_DATABASE |
private WriteConcern |
writeConcern |
Constructor and Description |
---|
DropDatabaseOperation(java.lang.String databaseName)
Deprecated.
|
DropDatabaseOperation(java.lang.String databaseName,
WriteConcern writeConcern)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Void |
execute(WriteBinding binding)
General execute which can return anything of type T
|
void |
executeAsync(AsyncWriteBinding binding,
SingleResultCallback<java.lang.Void> callback)
General execute which can return anything of type T
|
private BsonDocument |
getCommand(ConnectionDescription description) |
WriteConcern |
getWriteConcern()
Gets the write concern.
|
private static final BsonDocument DROP_DATABASE
private final java.lang.String databaseName
private final WriteConcern writeConcern
@Deprecated public DropDatabaseOperation(java.lang.String databaseName)
databaseName
- the name of the database for the operation.public DropDatabaseOperation(java.lang.String databaseName, WriteConcern writeConcern)
databaseName
- the name of the database for the operation.writeConcern
- the write concernpublic WriteConcern getWriteConcern()
public java.lang.Void execute(WriteBinding binding)
WriteOperation
execute
in interface WriteOperation<java.lang.Void>
binding
- the binding to execute in the context ofpublic void executeAsync(AsyncWriteBinding binding, SingleResultCallback<java.lang.Void> callback)
AsyncWriteOperation
executeAsync
in interface AsyncWriteOperation<java.lang.Void>
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executedprivate BsonDocument getCommand(ConnectionDescription description)