class AggregateIterableImpl<TDocument,TResult> extends java.lang.Object implements AggregateIterable<TResult>
Modifier and Type | Field and Description |
---|---|
private java.lang.Boolean |
allowDiskUse |
private java.lang.Integer |
batchSize |
private java.lang.Boolean |
bypassDocumentValidation |
private CodecRegistry |
codecRegistry |
private Collation |
collation |
private java.lang.Class<TDocument> |
documentClass |
private AsyncOperationExecutor |
executor |
private long |
maxTimeMS |
private MongoNamespace |
namespace |
private java.util.List<? extends Bson> |
pipeline |
private ReadConcern |
readConcern |
private ReadPreference |
readPreference |
private java.lang.Class<TResult> |
resultClass |
private java.lang.Boolean |
useCursor |
private WriteConcern |
writeConcern |
Constructor and Description |
---|
AggregateIterableImpl(MongoNamespace namespace,
java.lang.Class<TDocument> documentClass,
java.lang.Class<TResult> resultClass,
CodecRegistry codecRegistry,
ReadPreference readPreference,
ReadConcern readConcern,
WriteConcern writeConcern,
AsyncOperationExecutor executor,
java.util.List<? extends Bson> pipeline) |
Modifier and Type | Method and Description |
---|---|
AggregateIterable<TResult> |
allowDiskUse(java.lang.Boolean allowDiskUse)
Enables writing to temporary files.
|
void |
batchCursor(SingleResultCallback<AsyncBatchCursor<TResult>> callback)
Provide the underlying
AsyncBatchCursor allowing fine grained control of the cursor. |
AggregateIterable<TResult> |
batchSize(int batchSize)
Sets the number of documents to return per batch.
|
AggregateIterable<TResult> |
bypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
Sets the bypass document level validation flag.
|
AggregateIterable<TResult> |
collation(Collation collation)
Sets the collation options
|
private java.util.List<BsonDocument> |
createBsonDocumentList() |
private MongoIterable<TResult> |
execute() |
void |
first(SingleResultCallback<TResult> callback)
Helper to return the first item in the iterator or null.
|
void |
forEach(Block<? super TResult> block,
SingleResultCallback<java.lang.Void> callback)
Iterates over all documents in the view, applying the given block to each, and completing the returned future after all documents
have been iterated, or an exception has occurred.
|
private BsonValue |
getAggregateOutCollection(java.util.List<BsonDocument> aggregateList) |
<A extends java.util.Collection<? super TResult>> |
into(A target,
SingleResultCallback<A> callback)
Iterates over all the documents, adding each to the given target.
|
<U> MongoIterable<U> |
map(Function<TResult,U> mapper)
Maps this iterable from the source document type to the target document type.
|
AggregateIterable<TResult> |
maxTime(long maxTime,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.
|
void |
toCollection(SingleResultCallback<java.lang.Void> callback)
Aggregates documents according to the specified aggregation pipeline, which must end with a $out stage.
|
AggregateIterable<TResult> |
useCursor(java.lang.Boolean useCursor)
Deprecated.
|
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 WriteConcern writeConcern
private final CodecRegistry codecRegistry
private final AsyncOperationExecutor executor
private final java.util.List<? extends Bson> pipeline
private java.lang.Boolean allowDiskUse
private java.lang.Integer batchSize
private long maxTimeMS
private java.lang.Boolean useCursor
private java.lang.Boolean bypassDocumentValidation
private Collation collation
AggregateIterableImpl(MongoNamespace namespace, java.lang.Class<TDocument> documentClass, java.lang.Class<TResult> resultClass, CodecRegistry codecRegistry, ReadPreference readPreference, ReadConcern readConcern, WriteConcern writeConcern, AsyncOperationExecutor executor, java.util.List<? extends Bson> pipeline)
public AggregateIterable<TResult> allowDiskUse(java.lang.Boolean allowDiskUse)
AggregateIterable
allowDiskUse
in interface AggregateIterable<TResult>
allowDiskUse
- true if writing to temporary files is enabledpublic AggregateIterable<TResult> batchSize(int batchSize)
AggregateIterable
batchSize
in interface AggregateIterable<TResult>
batchSize
in interface MongoIterable<TResult>
batchSize
- the batch sizepublic AggregateIterable<TResult> maxTime(long maxTime, java.util.concurrent.TimeUnit timeUnit)
AggregateIterable
maxTime
in interface AggregateIterable<TResult>
maxTime
- the max timetimeUnit
- the time unit, which may not be null@Deprecated public AggregateIterable<TResult> useCursor(java.lang.Boolean useCursor)
AggregateIterable
useCursor
in interface AggregateIterable<TResult>
useCursor
- whether the server should use a cursor to return resultspublic void toCollection(SingleResultCallback<java.lang.Void> callback)
AggregateIterable
toCollection
in interface AggregateIterable<TResult>
callback
- the callback, which is called when the aggregation completespublic void first(SingleResultCallback<TResult> callback)
MongoIterable
first
in interface MongoIterable<TResult>
callback
- a callback that is passed the first item or null.public void forEach(Block<? super TResult> block, SingleResultCallback<java.lang.Void> callback)
MongoIterable
forEach
in interface MongoIterable<TResult>
block
- the block to apply to each documentcallback
- a callback that completed once the iteration has completedpublic <A extends java.util.Collection<? super TResult>> void into(A target, SingleResultCallback<A> callback)
MongoIterable
into
in interface MongoIterable<TResult>
A
- the collection typetarget
- the collection to insert intocallback
- a callback that will be passed the target containing all documentspublic <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 batchCursor(SingleResultCallback<AsyncBatchCursor<TResult>> callback)
MongoIterable
AsyncBatchCursor
allowing fine grained control of the cursor.batchCursor
in interface MongoIterable<TResult>
callback
- a callback that will be passed the AsyncBatchCursorpublic AggregateIterable<TResult> bypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
AggregateIterable
Note: This only applies when an $out stage is specified
.bypassDocumentValidation
in interface AggregateIterable<TResult>
bypassDocumentValidation
- If true, allows the write to opt-out of document level validation.public AggregateIterable<TResult> collation(Collation collation)
AggregateIterable
A null value represents the server default.
collation
in interface AggregateIterable<TResult>
collation
- the collation options to useprivate MongoIterable<TResult> execute()
private BsonValue getAggregateOutCollection(java.util.List<BsonDocument> aggregateList)
private java.util.List<BsonDocument> createBsonDocumentList()