public class RenameCollectionOperation extends java.lang.Object implements AsyncWriteOperation<java.lang.Void>, WriteOperation<java.lang.Void>
If the new name is the same as an existing collection and dropTarget is true, this existing collection will be dropped. If dropTarget is false and the newCollectionName is the same as an existing collection, a MongoServerException will be thrown.
| 构造器和说明 |
|---|
RenameCollectionOperation(MongoNamespace originalNamespace,
MongoNamespace newNamespace) |
| 限定符和类型 | 方法和说明 |
|---|---|
RenameCollectionOperation |
dropTarget(boolean dropTarget)
Sets if mongod should drop the target of renameCollection prior to renaming the collection.
|
java.lang.Void |
execute(WriteBinding binding)
Rename the collection with
oldCollectionName in database databaseName to the newCollectionName. |
void |
executeAsync(AsyncWriteBinding binding,
SingleResultCallback<java.lang.Void> callback)
General execute which can return anything of type T
|
boolean |
isDropTarget()
Gets if mongod should drop the target of renameCollection prior to renaming the collection.
|
public RenameCollectionOperation(MongoNamespace originalNamespace, MongoNamespace newNamespace)
originalNamespace - the name of the collection to renamenewNamespace - the desired new name for the collectionpublic boolean isDropTarget()
public RenameCollectionOperation dropTarget(boolean dropTarget)
dropTarget - true if mongod should drop the target of renameCollection prior to renaming the collection.public java.lang.Void execute(WriteBinding binding)
oldCollectionName in database databaseName to the newCollectionName.execute 在接口中 WriteOperation<java.lang.Void>binding - the bindingMongoServerException - if you provide a newCollectionName that is the name of an existing collection and dropTarget
is false, or if the oldCollectionName is the name of a collection that doesn't existpublic void executeAsync(AsyncWriteBinding binding, SingleResultCallback<java.lang.Void> callback)
AsyncWriteOperationexecuteAsync 在接口中 AsyncWriteOperation<java.lang.Void>binding - the binding to execute in the context ofcallback - the callback to be called when the operation has been executed