T
- the operations result type.AsyncReadOperation<AsyncBatchCursor<T>>
, ReadOperation<BatchCursor<T>>
public class ChangeStreamOperation<T> extends Object implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>>
$changeStream
aggregation.Constructor | Description |
---|---|
ChangeStreamOperation(MongoNamespace namespace,
FullDocument fullDocument,
List<BsonDocument> pipeline,
Decoder<T> decoder) |
Construct a new instance.
|
ChangeStreamOperation(MongoNamespace namespace,
FullDocument fullDocument,
List<BsonDocument> pipeline,
Decoder<T> decoder,
ChangeStreamLevel changeStreamLevel) |
Construct a new instance.
|
Modifier and Type | Method | Description |
---|---|---|
ChangeStreamOperation<T> |
batchSize(Integer batchSize) |
Sets the number of documents to return per batch.
|
ChangeStreamOperation<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
|
Integer |
getBatchSize() |
Gets the number of documents to return per batch.
|
Collation |
getCollation() |
Returns the collation options
|
Decoder<T> |
getDecoder() |
|
FullDocument |
getFullDocument() |
Returns the fullDocument value, in 3.6
|
long |
getMaxAwaitTime(TimeUnit timeUnit) |
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor
query.
|
MongoNamespace |
getNamespace() |
|
List<BsonDocument> |
getPipeline() |
Gets the aggregation pipeline.
|
BsonDocument |
getResumeToken() |
Returns the logical starting point for the new change stream.
|
BsonTimestamp |
getStartAtOperationTime() |
Returns the start at operation time
|
ChangeStreamOperation<T> |
maxAwaitTime(long maxAwaitTime,
TimeUnit timeUnit) |
Sets the maximum await execution time on the server for this operation.
|
ChangeStreamOperation<T> |
resumeAfter(BsonDocument resumeToken) |
Sets the logical starting point for the new change stream.
|
ChangeStreamOperation<T> |
startAtOperationTime(BsonTimestamp startAtOperationTime) |
The change stream will only provides changes that occurred after the specified timestamp.
|
public ChangeStreamOperation(MongoNamespace namespace, FullDocument fullDocument, List<BsonDocument> pipeline, Decoder<T> decoder)
namespace
- the database and collection namespace for the operation.fullDocument
- the fullDocument valuepipeline
- the aggregation pipeline.decoder
- the decoder for the result documents.public ChangeStreamOperation(MongoNamespace namespace, FullDocument fullDocument, List<BsonDocument> pipeline, Decoder<T> decoder, ChangeStreamLevel changeStreamLevel)
namespace
- the database and collection namespace for the operation.fullDocument
- the fullDocument valuepipeline
- the aggregation pipeline.decoder
- the decoder for the result documents.changeStreamLevel
- the level at which the change stream is observingpublic MongoNamespace getNamespace()
public FullDocument getFullDocument()
public BsonDocument getResumeToken()
A null value represents the server default.
public ChangeStreamOperation<T> resumeAfter(BsonDocument resumeToken)
resumeToken
- the resumeTokenpublic List<BsonDocument> getPipeline()
public Integer getBatchSize()
public ChangeStreamOperation<T> batchSize(Integer batchSize)
batchSize
- the batch sizepublic long getMaxAwaitTime(TimeUnit timeUnit)
timeUnit
- the time unit to return the result inpublic ChangeStreamOperation<T> maxAwaitTime(long maxAwaitTime, TimeUnit timeUnit)
maxAwaitTime
- the max await time. A value less than one will be ignored, and indicates that the driver should respect the
server's default valuetimeUnit
- the time unit, which may not be nullpublic Collation getCollation()
public ChangeStreamOperation<T> collation(Collation collation)
A null value represents the server default.
collation
- the collation options to usepublic ChangeStreamOperation<T> startAtOperationTime(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 timepublic BsonTimestamp getStartAtOperationTime()
public 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