AsyncWriteOperation<Void>
, WriteOperation<Void>
public class CreateIndexesOperation extends Object implements AsyncWriteOperation<Void>, WriteOperation<Void>
Multiple index creation is supported starting with MongoDB server version 2.6
Constructor | Description |
---|---|
CreateIndexesOperation(MongoNamespace namespace,
List<IndexRequest> requests) |
Deprecated.
|
CreateIndexesOperation(MongoNamespace namespace,
List<IndexRequest> requests,
WriteConcern writeConcern) |
Construct a new instance.
|
Modifier and Type | Method | Description |
---|---|---|
Void |
execute(WriteBinding binding) |
General execute which can return anything of type T
|
void |
executeAsync(AsyncWriteBinding binding,
SingleResultCallback<Void> callback) |
General execute which can return anything of type T
|
List<String> |
getIndexNames() |
Gets the index names.
|
long |
getMaxTime(TimeUnit timeUnit) |
Gets the maximum execution time on the server for this operation.
|
List<IndexRequest> |
getRequests() |
Gets the index requests.
|
WriteConcern |
getWriteConcern() |
Gets the write concern.
|
CreateIndexesOperation |
maxTime(long maxTime,
TimeUnit timeUnit) |
Sets the maximum execution time on the server for this operation.
|
@Deprecated public CreateIndexesOperation(MongoNamespace namespace, List<IndexRequest> requests)
CreateIndexesOperation(MongoNamespace, List, WriteConcern)
namespace
- the database and collection namespace for the operation.requests
- the index requestpublic CreateIndexesOperation(MongoNamespace namespace, List<IndexRequest> requests, WriteConcern writeConcern)
namespace
- the database and collection namespace for the operation.requests
- the index requestwriteConcern
- the write concernpublic WriteConcern getWriteConcern()
public List<IndexRequest> getRequests()
public List<String> getIndexNames()
public long getMaxTime(TimeUnit timeUnit)
timeUnit
- the time unit to return the result inpublic CreateIndexesOperation maxTime(long maxTime, TimeUnit timeUnit)
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic Void execute(WriteBinding binding)
WriteOperation
execute
in interface WriteOperation<Void>
binding
- the binding to execute in the context ofpublic void executeAsync(AsyncWriteBinding binding, SingleResultCallback<Void> callback)
AsyncWriteOperation
executeAsync
in interface AsyncWriteOperation<Void>
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executed