class DistinctIterableImpl<TDocument,TResult> extends java.lang.Object implements DistinctIterable<TResult>
Modifier and Type | Field and Description |
---|---|
private CodecRegistry |
codecRegistry |
private Collation |
collation |
private java.lang.Class<TDocument> |
documentClass |
private OperationExecutor |
executor |
private java.lang.String |
fieldName |
private Bson |
filter |
private long |
maxTimeMS |
private MongoNamespace |
namespace |
private ReadConcern |
readConcern |
private ReadPreference |
readPreference |
private java.lang.Class<TResult> |
resultClass |
Constructor and Description |
---|
DistinctIterableImpl(MongoNamespace namespace,
java.lang.Class<TDocument> documentClass,
java.lang.Class<TResult> resultClass,
CodecRegistry codecRegistry,
ReadPreference readPreference,
ReadConcern readConcern,
OperationExecutor executor,
java.lang.String fieldName,
Bson filter) |
Modifier and Type | Method and Description |
---|---|
DistinctIterable<TResult> |
batchSize(int batchSize)
Sets the number of documents to return per batch.
|
DistinctIterable<TResult> |
collation(Collation collation)
Sets the collation options
|
private MongoIterable<TResult> |
execute() |
DistinctIterable<TResult> |
filter(Bson filter)
Sets the query filter to apply to the query.
|
TResult |
first()
Helper to return the first item in the iterator or null.
|
void |
forEach(Block<? super TResult> block)
Iterates over all documents in the view, applying the given block to each.
|
<A extends java.util.Collection<? super TResult>> |
into(A target)
Iterates over all the documents, adding each to the given target.
|
MongoCursor<TResult> |
iterator() |
<U> MongoIterable<U> |
map(Function<TResult,U> mapper)
Maps this iterable from the source document type to the target document type.
|
DistinctIterable<TResult> |
maxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
private final MongoNamespace namespace
private final java.lang.Class<TDocument> documentClass
private final java.lang.Class<TResult> resultClass
private final ReadPreference readPreference
private final ReadConcern readConcern
private final CodecRegistry codecRegistry
private final OperationExecutor executor
private final java.lang.String fieldName
private Bson filter
private long maxTimeMS
private Collation collation
DistinctIterableImpl(MongoNamespace namespace, java.lang.Class<TDocument> documentClass, java.lang.Class<TResult> resultClass, CodecRegistry codecRegistry, ReadPreference readPreference, ReadConcern readConcern, OperationExecutor executor, java.lang.String fieldName, Bson filter)
public DistinctIterable<TResult> filter(Bson filter)
DistinctIterable
filter
in interface DistinctIterable<TResult>
filter
- the filter, which may be null.public DistinctIterable<TResult> maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
DistinctIterable
maxTime
in interface DistinctIterable<TResult>
maxTime
- the max timetimeUnit
- the time unit, which may not be nullpublic DistinctIterable<TResult> batchSize(int batchSize)
DistinctIterable
batchSize
in interface DistinctIterable<TResult>
batchSize
in interface MongoIterable<TResult>
batchSize
- the batch sizepublic DistinctIterable<TResult> collation(Collation collation)
DistinctIterable
A null value represents the server default.
collation
in interface DistinctIterable<TResult>
collation
- the collation options to usepublic MongoCursor<TResult> iterator()
iterator
in interface MongoIterable<TResult>
iterator
in interface java.lang.Iterable<TResult>
public TResult first()
MongoIterable
first
in interface MongoIterable<TResult>
public <U> MongoIterable<U> map(Function<TResult,U> mapper)
MongoIterable
map
in interface MongoIterable<TResult>
U
- the target document typemapper
- a function that maps from the source to the target document typepublic void forEach(Block<? super TResult> block)
MongoIterable
Similar to map
but the function is fully encapsulated with no returned result.
forEach
in interface MongoIterable<TResult>
block
- the block to apply to each document of type T.public <A extends java.util.Collection<? super TResult>> A into(A target)
MongoIterable
into
in interface MongoIterable<TResult>
A
- the collection typetarget
- the collection to insert intoprivate MongoIterable<TResult> execute()