Class ChangeStreamOperation<T>

    • Constructor Detail

      • 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 value
        pipeline - 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 value
        pipeline - 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
      • getDecoder

        public Decoder<T> getDecoder()
        Deprecated.
        Returns:
        the decoder 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.
        use getResumeAfter() instead
        Returns 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
        Since server release
        4.2
      • 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
        Since server release
        4.2
      • startAfter

        public ChangeStreamOperation<T> startAfter​(BsonDocument startAfter)
        Deprecated.
        Similar to 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.

        Parameters:
        startAfter - the startAfter resumeToken
        Returns:
        this
        Since:
        3.11
        MongoDB documentation
        changeStreams/#change-stream-start-after
        Since server release
        4.2
      • getBatchSize

        public 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
        MongoDB documentation
        Batch Size
      • batchSize

        public ChangeStreamOperation<T> batchSize​(Integer batchSize)
        Deprecated.
        Sets the number of documents to return per batch.
        Parameters:
        batchSize - the batch size
        Returns:
        this
        MongoDB documentation
        Batch Size
      • getMaxAwaitTime

        public long getMaxAwaitTime​(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
        MongoDB documentation
        Max Time
      • maxAwaitTime

        public ChangeStreamOperation<T> maxAwaitTime​(long maxAwaitTime,
                                                     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 value
        timeUnit - the time unit, which may not be null
        Returns:
        this
      • getCollation

        public Collation getCollation()
        Deprecated.
        Returns the collation options
        Returns:
        the collation options
        MongoDB documentation
        Aggregation
      • collation

        public ChangeStreamOperation<T> collation​(Collation collation)
        Deprecated.
        Sets the collation options

        A null value represents the server default.

        Parameters:
        collation - the collation options to use
        Returns:
        this
        MongoDB documentation
        Aggregation
      • 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
        MongoDB documentation
        reference/method/db.runCommand/
        Since server release
        4.0
      • getStartAtOperationTime

        public BsonTimestamp getStartAtOperationTime()
        Deprecated.
        Returns the start at operation time
        Returns:
        the start at operation time
        Since:
        3.8
        Since server release
        4.0
      • 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
        MongoDB documentation
        Filter
      • 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 interface ReadOperation<T>
        Parameters:
        binding - the binding to execute in the context of
        Returns:
        T, the result of the execution
      • 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 resume
        maxWireVersion - the max wire version reported by the server description
        Since:
        3.11