public class CreateIndexesOperation extends java.lang.Object implements AsyncWriteOperation<java.lang.Void>, WriteOperation<java.lang.Void>
Multiple index creation is supported starting with MongoDB server version 2.6
Constructor and Description |
---|
CreateIndexesOperation(MongoNamespace namespace,
java.util.List<IndexRequest> requests)
Deprecated.
|
CreateIndexesOperation(MongoNamespace namespace,
java.util.List<IndexRequest> requests,
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
|
java.util.List<java.lang.String> |
getIndexNames()
Gets the index names.
|
long |
getMaxTime(java.util.concurrent.TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation.
|
java.util.List<IndexRequest> |
getRequests()
Gets the index requests.
|
WriteConcern |
getWriteConcern()
Gets the write concern.
|
CreateIndexesOperation |
maxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
@Deprecated public CreateIndexesOperation(MongoNamespace namespace, java.util.List<IndexRequest> requests)
CreateIndexesOperation(MongoNamespace, List, WriteConcern)
namespace
- the database and collection namespace for the operation.requests
- the index requestpublic CreateIndexesOperation(MongoNamespace namespace, java.util.List<IndexRequest> requests, WriteConcern writeConcern)
namespace
- the database and collection namespace for the operation.requests
- the index requestwriteConcern
- the write concernpublic WriteConcern getWriteConcern()
public java.util.List<IndexRequest> getRequests()
public java.util.List<java.lang.String> getIndexNames()
public long getMaxTime(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- the time unit to return the result inpublic CreateIndexesOperation maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic 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 executed