Package com.mongodb.operation
Class ChangeStreamOperation<T>
java.lang.Object
com.mongodb.operation.ChangeStreamOperation<T>
- Type Parameters:
T
- the operations result type.
- All Implemented Interfaces:
AsyncReadOperation<AsyncBatchCursor<T>>
,ReadOperation<BatchCursor<T>>
@Deprecated
public class ChangeStreamOperation<T>
extends Object
implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>>
Deprecated.
An operation that executes an
$changeStream
aggregation.- Since:
- 3.6
-
Constructor Summary
ConstructorsConstructorDescriptionChangeStreamOperation
(MongoNamespace namespace, FullDocument fullDocument, List<BsonDocument> pipeline, Decoder<T> decoder) Deprecated.Construct a new instance.ChangeStreamOperation
(MongoNamespace namespace, FullDocument fullDocument, List<BsonDocument> pipeline, Decoder<T> decoder, ChangeStreamLevel changeStreamLevel) Deprecated.Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Sets the number of documents to return per batch.Deprecated.Sets the collation optionsexecute
(ReadBinding binding) Deprecated.General execute which can return anything of type Tvoid
executeAsync
(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback) Deprecated.General execute which can return anything of type TDeprecated.Gets the number of documents to return per batch.Deprecated.Returns the collation optionsDeprecated.Deprecated.Returns the fullDocument value, in 3.6long
getMaxAwaitTime
(TimeUnit timeUnit) Deprecated.The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query.Deprecated.Deprecated.Gets the aggregation pipeline.Deprecated.Returns the logical starting point for the new change stream.Deprecated.boolean
Deprecated.Gets the value for retryable reads.Deprecated.Returns the logical starting point for the new change stream returning the first notification after the token.Deprecated.Returns the start at operation timemaxAwaitTime
(long maxAwaitTime, TimeUnit timeUnit) Deprecated.Sets the maximum await execution time on the server for this operation.resumeAfter
(BsonDocument resumeAfter) Deprecated.Sets the logical starting point for the new change stream.retryReads
(boolean retryReads) Deprecated.Enables retryable reads if a read fails due to a network error.void
setChangeStreamOptionsForResume
(BsonDocument resumeToken, int maxWireVersion) Deprecated.Set the change stream operation options for a resumeable operation.startAfter
(BsonDocument startAfter) Deprecated.Similar toresumeAfter
, this option takes a resume token and starts a new change stream returning the first notification after the token.startAtOperationTime
(BsonTimestamp startAtOperationTime) Deprecated.The change stream will only provides changes that occurred after the specified timestamp.
-
Constructor Details
-
ChangeStreamOperation
public ChangeStreamOperation(MongoNamespace namespace, FullDocument fullDocument, List<BsonDocument> pipeline, Decoder<T> decoder) Deprecated.Construct a new instance.- Parameters:
namespace
- the database and collection namespace for the operation.fullDocument
- the fullDocument valuepipeline
- the aggregation pipeline.decoder
- the decoder for the result documents.
-
ChangeStreamOperation
public ChangeStreamOperation(MongoNamespace namespace, FullDocument fullDocument, List<BsonDocument> pipeline, Decoder<T> decoder, ChangeStreamLevel changeStreamLevel) Deprecated.Construct a new instance.- Parameters:
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 observing- Since:
- 3.8
-
-
Method Details
-
getNamespace
Deprecated.- Returns:
- the namespace for this operation
-
getDecoder
Deprecated.- Returns:
- the decoder for this operation
-
getFullDocument
Deprecated.Returns the fullDocument value, in 3.6- Returns:
- the fullDocument value
-
getResumeToken
Deprecated.usegetResumeAfter()
insteadReturns the logical starting point for the new change stream.A null value represents the server default.
- Returns:
- the resumeAfter
-
getResumeAfter
Deprecated.Returns the logical starting point for the new change stream.A null value represents the server default.
- Returns:
- the resumeAfter resumeToken
- Since:
- 3.11
-
resumeAfter
Deprecated.Sets the logical starting point for the new change stream.- Parameters:
resumeAfter
- the resumeToken- Returns:
- this
-
getStartAfter
Deprecated.Returns the logical starting point for the new change stream returning the first notification after the token.A null value represents the server default.
- Returns:
- the startAfter resumeToken
- Since:
- 3.11
-
startAfter
Deprecated.Similar toresumeAfter
, 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
andresumeAfter
are specified.- Parameters:
startAfter
- the startAfter resumeToken- Returns:
- this
- Since:
- 3.11
-
getPipeline
Deprecated.Gets the aggregation pipeline.- Returns:
- the pipeline
-
getBatchSize
Deprecated.Gets the number of documents to return per batch. Default to 0, which indicates that the server chooses an appropriate batch size.- Returns:
- the batch size, which may be null
-
batchSize
Deprecated.Sets the number of documents to return per batch.- Parameters:
batchSize
- the batch size- Returns:
- this
-
getMaxAwaitTime
Deprecated.The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. This only applies to a TAILABLE_AWAIT cursor. When the cursor is not a TAILABLE_AWAIT cursor, this option is ignored. A zero value will be ignored.- Parameters:
timeUnit
- the time unit to return the result in- Returns:
- the maximum await execution time in the given time unit
-
maxAwaitTime
Deprecated.Sets the maximum await execution time on the server for this operation.- Parameters:
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 null- Returns:
- this
-
getCollation
Deprecated.Returns the collation options- Returns:
- the collation options
-
collation
Deprecated.Sets the collation optionsA null value represents the server default.
- Parameters:
collation
- the collation options to use- Returns:
- this
-
startAtOperationTime
Deprecated.The change stream will only provides changes that occurred 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
-
getStartAtOperationTime
Deprecated.Returns the start at operation time- Returns:
- the start at operation time
- Since:
- 3.8
-
retryReads
Deprecated.Enables retryable reads if a read fails due to a network error.- Parameters:
retryReads
- true if reads should be retried- Returns:
- this
- Since:
- 3.11
-
getRetryReads
public boolean getRetryReads()Deprecated.Gets the value for retryable reads. The default is true.- Returns:
- the retryable reads value
- Since:
- 3.11
-
execute
Deprecated.Description copied from interface:ReadOperation
General execute which can return anything of type T- Specified by:
execute
in interfaceReadOperation<T>
- Parameters:
binding
- the binding to execute in the context of- Returns:
- T, the result of the execution
-
executeAsync
public void executeAsync(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback) Deprecated.Description copied from interface:AsyncReadOperation
General execute which can return anything of type T- Specified by:
executeAsync
in interfaceAsyncReadOperation<T>
- Parameters:
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executed
-
setChangeStreamOptionsForResume
Deprecated.Set the change stream operation options for a resumeable operation.- Parameters:
resumeToken
- the resume token cached prior to resumemaxWireVersion
- the max wire version reported by the server description- Since:
- 3.11
-
getResumeAfter()
instead