T
- the type of the distinct valueAsyncReadOperation<AsyncBatchCursor<T>>
, ReadOperation<BatchCursor<T>>
public class DistinctOperation<T> extends Object implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>>
When possible, the distinct command uses an index to find documents and return values.
Constructor | Description |
---|---|
DistinctOperationβ(MongoNamespace namespace,
String fieldName,
Decoder<T> decoder) |
Construct an instance.
|
Modifier and Type | Method | Description |
---|---|---|
DistinctOperation<T> |
collationβ(Collation collation) |
Sets the collation options
|
BatchCursor<T> |
executeβ(ReadBinding binding) |
General execute which can return anything of type T
|
void |
executeAsyncβ(AsyncReadBinding binding,
SingleResultCallback<AsyncBatchCursor<T>> callback) |
General execute which can return anything of type T
|
DistinctOperation<T> |
filterβ(BsonDocument filter) |
Sets the query filter to apply to the query.
|
Collation |
getCollationβ() |
Returns the collation options
|
BsonDocument |
getFilterβ() |
Gets the query filter.
|
long |
getMaxTimeβ(TimeUnit timeUnit) |
Gets the maximum execution time on the server for this operation.
|
DistinctOperation<T> |
maxTimeβ(long maxTime,
TimeUnit timeUnit) |
Sets the maximum execution time on the server for this operation.
|
public DistinctOperationβ(MongoNamespace namespace, String fieldName, Decoder<T> decoder)
namespace
- the database and collection namespace for the operation.fieldName
- the name of the field to return distinct values.decoder
- the decoder for the result documents.public BsonDocument getFilterβ()
public DistinctOperation<T> filterβ(BsonDocument filter)
filter
- the query filter, which may be null.public long getMaxTimeβ(TimeUnit timeUnit)
timeUnit
- the time unit to return the result inpublic DistinctOperation<T> maxTimeβ(long maxTime, TimeUnit timeUnit)
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic Collation getCollationβ()
public DistinctOperation<T> collationβ(Collation collation)
A null value represents the server default.
collation
- the collation options to usepublic BatchCursor<T> executeβ(ReadBinding binding)
ReadOperation
execute
in interface ReadOperation<T>
binding
- the binding to execute in the context ofpublic void executeAsyncβ(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback)
AsyncReadOperation
executeAsync
in interface AsyncReadOperation<T>
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executed