TResult
- The type of the result.public interface ChangeStreamPublisher<TResult>
extends org.reactivestreams.Publisher<com.mongodb.client.model.changestream.ChangeStreamDocument<TResult>>
Modifier and Type | Method and Description |
---|---|
ChangeStreamPublisher<TResult> |
batchSize(int batchSize)
Sets the number of documents to return per batch.
|
ChangeStreamPublisher<TResult> |
collation(com.mongodb.client.model.Collation collation)
Sets the collation options
|
org.reactivestreams.Publisher<com.mongodb.client.model.changestream.ChangeStreamDocument<TResult>> |
first()
Helper to return a publisher limited to the first result.
|
ChangeStreamPublisher<TResult> |
fullDocument(com.mongodb.client.model.changestream.FullDocument fullDocument)
Sets the fullDocument value.
|
ChangeStreamPublisher<TResult> |
maxAwaitTime(long maxAwaitTime,
TimeUnit timeUnit)
Sets the maximum await execution time on the server for this operation.
|
ChangeStreamPublisher<TResult> |
resumeAfter(org.bson.BsonDocument resumeToken)
Sets the logical starting point for the new change stream.
|
ChangeStreamPublisher<TResult> |
startAfter(org.bson.BsonDocument startAfter)
Similar to
resumeAfter , this option takes a resume token and starts a
new change stream returning the first notification after the token. |
ChangeStreamPublisher<TResult> |
startAtOperationTime(org.bson.BsonTimestamp startAtOperationTime)
The change stream will only provide changes that occurred after the specified timestamp.
|
<TDocument> |
withDocumentClass(Class<TDocument> clazz)
Returns a
MongoIterable containing the results of the change stream based on the document class provided. |
ChangeStreamPublisher<TResult> fullDocument(com.mongodb.client.model.changestream.FullDocument fullDocument)
fullDocument
- the fullDocumentChangeStreamPublisher<TResult> resumeAfter(org.bson.BsonDocument resumeToken)
resumeToken
- the resume tokenChangeStreamPublisher<TResult> startAtOperationTime(org.bson.BsonTimestamp startAtOperationTime)
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.
startAtOperationTime
- the start at operation timeChangeStreamPublisher<TResult> startAfter(org.bson.BsonDocument startAfter)
resumeAfter
, this option takes a resume token and starts a
new change stream returning the first notification after the token.
This will allow users to watch collections that have been dropped and recreated or newly renamed collections without missing any notifications.
Note: The server will report an error if both startAfter
and resumeAfter
are specified.
startAfter
- the startAfter resumeTokenChangeStreamPublisher<TResult> maxAwaitTime(long maxAwaitTime, TimeUnit timeUnit)
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 nullChangeStreamPublisher<TResult> collation(com.mongodb.client.model.Collation collation)
A null value represents the server default.
collation
- the collation options to use<TDocument> org.reactivestreams.Publisher<TDocument> withDocumentClass(Class<TDocument> clazz)
MongoIterable
containing the results of the change stream based on the document class provided.TDocument
- the result typeclazz
- the class to use for the raw result.ChangeStreamPublisher<TResult> batchSize(int batchSize)
Overrides the Subscription.request(long)
value for setting the batch size, allowing for fine grained
control over the underlying cursor.
batchSize
- the batch sizeorg.reactivestreams.Publisher<com.mongodb.client.model.changestream.ChangeStreamDocument<TResult>> first()