Package com.mongodb.operation
Class RenameCollectionOperation
- java.lang.Object
-
- com.mongodb.operation.RenameCollectionOperation
-
- All Implemented Interfaces:
AsyncWriteOperation<Void>
,WriteOperation<Void>
@Deprecated public class RenameCollectionOperation extends Object implements AsyncWriteOperation<Void>, WriteOperation<Void>
Deprecated.An operation that renames the given collection to the new name.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.
- Since:
- 3.0
- MongoDB documentation
- renameCollection
-
-
Constructor Summary
Constructors Constructor Description RenameCollectionOperation(MongoNamespace originalNamespace, MongoNamespace newNamespace)
Deprecated.RenameCollectionOperation(MongoNamespace originalNamespace, MongoNamespace newNamespace, WriteConcern writeConcern)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RenameCollectionOperation
dropTarget(boolean dropTarget)
Deprecated.Sets if mongod should drop the target of renameCollection prior to renaming the collection.Void
execute(WriteBinding binding)
Deprecated.Rename the collection witholdCollectionName
in databasedatabaseName
to thenewCollectionName
.void
executeAsync(AsyncWriteBinding binding, SingleResultCallback<Void> callback)
Deprecated.General execute which can return anything of type TWriteConcern
getWriteConcern()
Deprecated.Gets the write concern.boolean
isDropTarget()
Deprecated.Gets if mongod should drop the target of renameCollection prior to renaming the collection.
-
-
-
Constructor Detail
-
RenameCollectionOperation
@Deprecated public RenameCollectionOperation(MongoNamespace originalNamespace, MongoNamespace newNamespace)
Deprecated.- Parameters:
originalNamespace
- the name of the collection to renamenewNamespace
- the desired new name for the collection
-
RenameCollectionOperation
public RenameCollectionOperation(MongoNamespace originalNamespace, MongoNamespace newNamespace, WriteConcern writeConcern)
Deprecated.- Parameters:
originalNamespace
- the name of the collection to renamenewNamespace
- the desired new name for the collectionwriteConcern
- the writeConcern- Since:
- 3.4
-
-
Method Detail
-
getWriteConcern
public WriteConcern getWriteConcern()
Deprecated.Gets the write concern.- Returns:
- the write concern, which may be null
- Since:
- 3.4
-
isDropTarget
public boolean isDropTarget()
Deprecated.Gets if mongod should drop the target of renameCollection prior to renaming the collection.- Returns:
- true if mongod should drop the target of renameCollection prior to renaming the collection.
-
dropTarget
public RenameCollectionOperation dropTarget(boolean dropTarget)
Deprecated.Sets if mongod should drop the target of renameCollection prior to renaming the collection.- Parameters:
dropTarget
- true if mongod should drop the target of renameCollection prior to renaming the collection.- Returns:
- this
-
execute
public Void execute(WriteBinding binding)
Deprecated.Rename the collection witholdCollectionName
in databasedatabaseName
to thenewCollectionName
.- Specified by:
execute
in interfaceWriteOperation<Void>
- Parameters:
binding
- the binding- Returns:
- a void result
- Throws:
MongoServerException
- 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 exist
-
executeAsync
public void executeAsync(AsyncWriteBinding binding, SingleResultCallback<Void> callback)
Deprecated.Description copied from interface:AsyncWriteOperation
General execute which can return anything of type T- Specified by:
executeAsync
in interfaceAsyncWriteOperation<Void>
- Parameters:
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executed
-
-