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.
|
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.
|
ReadConcern |
getReadConcern() |
Gets the read concern
|
BsonDocument |
getResumeToken() |
Returns the logical starting point for the new change stream.
|
ChangeStreamOperation<T> |
maxAwaitTime(long maxAwaitTime,
TimeUnit timeUnit) |
Sets the maximum await execution time on the server for this operation.
|
ChangeStreamOperation<T> |
readConcern(ReadConcern readConcern) |
Sets the read concern
|
ChangeStreamOperation<T> |
resumeAfter(BsonDocument resumeToken) |
Sets the logical starting point for the new change stream.
|
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 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 ReadConcern getReadConcern()
public ChangeStreamOperation<T> readConcern(ReadConcern readConcern)
readConcern
- the read concernpublic Collation getCollation()
public ChangeStreamOperation<T> collation(Collation collation)
A null value represents the server default.
collation
- the collation options to usepublic 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