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 java.lang.Object implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>>
Deprecated.An operation that executes an$changeStream
aggregation.- Since:
- 3.6
-
-
Constructor Summary
Constructors Constructor Description ChangeStreamOperation(MongoNamespace namespace, FullDocument fullDocument, java.util.List<BsonDocument> pipeline, Decoder<T> decoder)
Deprecated.Construct a new instance.ChangeStreamOperation(MongoNamespace namespace, FullDocument fullDocument, java.util.List<BsonDocument> pipeline, Decoder<T> decoder, ChangeStreamLevel changeStreamLevel)
Deprecated.Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ChangeStreamOperation<T>
batchSize(java.lang.Integer batchSize)
Deprecated.Sets the number of documents to return per batch.ChangeStreamOperation<T>
collation(Collation collation)
Deprecated.Sets the collation optionsBatchCursor<T>
execute(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 Tjava.lang.Integer
getBatchSize()
Deprecated.Gets the number of documents to return per batch.Collation
getCollation()
Deprecated.Returns the collation optionsDecoder<T>
getDecoder()
Deprecated.FullDocument
getFullDocument()
Deprecated.Returns the fullDocument value, in 3.6long
getMaxAwaitTime(java.util.concurrent.TimeUnit timeUnit)
Deprecated.The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query.MongoNamespace
getNamespace()
Deprecated.java.util.List<BsonDocument>
getPipeline()
Deprecated.Gets the aggregation pipeline.BsonDocument
getResumeAfter()
Deprecated.Returns the logical starting point for the new change stream.BsonDocument
getResumeToken()
Deprecated.usegetResumeAfter()
insteadboolean
getRetryReads()
Deprecated.Gets the value for retryable reads.BsonDocument
getStartAfter()
Deprecated.Returns the logical starting point for the new change stream returning the first notification after the token.BsonTimestamp
getStartAtOperationTime()
Deprecated.Returns the start at operation timeChangeStreamOperation<T>
maxAwaitTime(long maxAwaitTime, java.util.concurrent.TimeUnit timeUnit)
Deprecated.Sets the maximum await execution time on the server for this operation.ChangeStreamOperation<T>
resumeAfter(BsonDocument resumeAfter)
Deprecated.Sets the logical starting point for the new change stream.ChangeStreamOperation<T>
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.ChangeStreamOperation<T>
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.ChangeStreamOperation<T>
startAtOperationTime(BsonTimestamp startAtOperationTime)
Deprecated.The change stream will only provides changes that occurred after the specified timestamp.
-
-
-
Constructor Detail
-
ChangeStreamOperation
public ChangeStreamOperation(MongoNamespace namespace, FullDocument fullDocument, java.util.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, java.util.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 Detail
-
getNamespace
public MongoNamespace getNamespace()
Deprecated.- Returns:
- the namespace for this operation
-
getFullDocument
public FullDocument getFullDocument()
Deprecated.Returns the fullDocument value, in 3.6- Returns:
- the fullDocument value
-
getResumeToken
@Deprecated public BsonDocument getResumeToken()
Deprecated.usegetResumeAfter()
insteadReturns the logical starting point for the new change stream.A null value represents the server default.
- Returns:
- the resumeAfter
-
getResumeAfter
public BsonDocument 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
public ChangeStreamOperation<T> resumeAfter(BsonDocument resumeAfter)
Deprecated.Sets the logical starting point for the new change stream.- Parameters:
resumeAfter
- the resumeToken- Returns:
- this
-
getStartAfter
public BsonDocument 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
public ChangeStreamOperation<T> 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.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
public java.util.List<BsonDocument> getPipeline()
Deprecated.Gets the aggregation pipeline.- Returns:
- the pipeline
-
getBatchSize
public java.lang.Integer 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
public ChangeStreamOperation<T> batchSize(java.lang.Integer batchSize)
Deprecated.Sets the number of documents to return per batch.- Parameters:
batchSize
- the batch size- Returns:
- this
-
getMaxAwaitTime
public long getMaxAwaitTime(java.util.concurrent.TimeUnit timeUnit)
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
public ChangeStreamOperation<T> maxAwaitTime(long maxAwaitTime, java.util.concurrent.TimeUnit timeUnit)
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
public Collation getCollation()
Deprecated.Returns the collation options- Returns:
- the collation options
-
collation
public ChangeStreamOperation<T> collation(Collation collation)
Deprecated.Sets the collation optionsA null value represents the server default.
- Parameters:
collation
- the collation options to use- Returns:
- this
-
startAtOperationTime
public ChangeStreamOperation<T> startAtOperationTime(BsonTimestamp 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
public BsonTimestamp getStartAtOperationTime()
Deprecated.Returns the start at operation time- Returns:
- the start at operation time
- Since:
- 3.8
-
retryReads
public ChangeStreamOperation<T> retryReads(boolean 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
public BatchCursor<T> execute(ReadBinding binding)
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
public void setChangeStreamOptionsForResume(BsonDocument resumeToken, int maxWireVersion)
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
-
-