Package com.mongodb.client
Interface ChangeStreamIterable<TResult>
-
- Type Parameters:
TResult
- The type of the result.
- All Superinterfaces:
Iterable<TResult>
,MongoIterable<ChangeStreamDocument<TResult>>
public interface ChangeStreamIterable<TResult> extends MongoIterable<ChangeStreamDocument<TResult>>
Iterable for change streams.Note: the
ChangeStreamDocument
class will not be applicable for all change stream outputs. If using custom pipelines that radically change the result, then thewithDocumentClass(Class)
method can be used to provide an alternative document format.- Since:
- 3.6
- Since server release
- 3.6
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ChangeStreamIterable<TResult>
batchSize(int batchSize)
Sets the number of documents to return per batch.ChangeStreamIterable<TResult>
collation(Collation collation)
Sets the collation optionsChangeStreamIterable<TResult>
fullDocument(FullDocument fullDocument)
Sets the fullDocument value.ChangeStreamIterable<TResult>
maxAwaitTime(long maxAwaitTime, TimeUnit timeUnit)
Sets the maximum await execution time on the server for this operation.ChangeStreamIterable<TResult>
resumeAfter(BsonDocument resumeToken)
Sets the logical starting point for the new change stream.ChangeStreamIterable<TResult>
startAtOperationTime(BsonTimestamp startAtOperationTime)
The change stream will only provide changes that occurred at or after the specified timestamp.<TDocument>
MongoIterable<TDocument>withDocumentClass(Class<TDocument> clazz)
Returns aMongoIterable
containing the results of the change stream based on the document class provided.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
fullDocument
ChangeStreamIterable<TResult> fullDocument(FullDocument fullDocument)
Sets the fullDocument value.- Parameters:
fullDocument
- the fullDocument- Returns:
- this
-
resumeAfter
ChangeStreamIterable<TResult> resumeAfter(BsonDocument resumeToken)
Sets the logical starting point for the new change stream.- Parameters:
resumeToken
- the resume token- Returns:
- this
-
batchSize
ChangeStreamIterable<TResult> batchSize(int batchSize)
Sets the number of documents to return per batch.- Specified by:
batchSize
in interfaceMongoIterable<TResult>
- Parameters:
batchSize
- the batch size- Returns:
- this
- MongoDB documentation
- Batch Size
-
maxAwaitTime
ChangeStreamIterable<TResult> maxAwaitTime(long maxAwaitTime, TimeUnit timeUnit)
Sets the maximum await execution time on the server for this operation.- Parameters:
maxAwaitTime
- the max await time. A zero value will be ignored, and indicates that the driver should respect the server's default valuetimeUnit
- the time unit, which may not be null- Returns:
- this
-
collation
ChangeStreamIterable<TResult> collation(@Nullable Collation collation)
Sets the collation optionsA null value represents the server default.
- Parameters:
collation
- the collation options to use- Returns:
- this
-
withDocumentClass
<TDocument> MongoIterable<TDocument> withDocumentClass(Class<TDocument> clazz)
Returns aMongoIterable
containing the results of the change stream based on the document class provided.- Type Parameters:
TDocument
- the result type- Parameters:
clazz
- the class to use for the raw result.- Returns:
- the new Mongo Iterable
-
startAtOperationTime
ChangeStreamIterable<TResult> startAtOperationTime(BsonTimestamp startAtOperationTime)
The change stream will only provide changes that occurred at or after the specified timestamp.Any command run against the server will return an operation time that can be used here.
The default value is an operation time obtained from the server before the change stream was created.
- Parameters:
startAtOperationTime
- the start at operation time- Returns:
- this
- Since:
- 3.8
- MongoDB documentation
- reference/method/db.runCommand/
- Since server release
- 4.0
-
-