Package dev.morphia.aggregation.stages
Class ChangeStream
- java.lang.Object
-
- dev.morphia.aggregation.stages.Stage
-
- dev.morphia.aggregation.stages.ChangeStream
-
public class ChangeStream extends Stage
Returns a Change Stream cursor on a collection, a database, or an entire cluster. Must be used as the first stage in an aggregation pipeline.- Since:
- 2.3
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ChangeStream()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Boolean
allChangesForCluster()
ChangeStream
allChangesForCluster(Boolean allChangesForCluster)
Sets whether the change stream should include all changes in the cluster.static ChangeStream
changeStream()
Returns a Change Stream cursor on a collection, a database, or an entire cluster.FullDocument
fullDocument()
ChangeStream
fullDocument(FullDocument fullDocument)
Specifies whether change notifications include a copy of the full document when modified by update operations.FullDocumentBeforeChange
fullDocumentBeforeChange()
ChangeStream
fullDocumentBeforeChange(FullDocumentBeforeChange fullDocumentBeforeChange)
Include the full document from before the change.Document
resumeAfter()
ChangeStream
resumeAfter(Document resumeAfter)
Specifies a resume token as the logical starting point for the change stream.Document
startAfter()
ChangeStream
startAfter(Document startAfter)
Specifies a resume token as the logical starting point for the change stream.LocalDateTime
startAtOperationTime()
ChangeStream
startAtOperationTime(LocalDateTime startAtOperationTime)
Specifies a time as the logical starting point for the change stream.String
toString()
-
Methods inherited from class dev.morphia.aggregation.stages.Stage
aggregation, stageName
-
-
-
-
Method Detail
-
changeStream
public static ChangeStream changeStream()
Returns a Change Stream cursor on a collection, a database, or an entire cluster. Must be used as the first stage in an aggregation pipeline.- Returns:
- the new ChangeStream stage
- Since:
- 2.3
- MongoDB documentation
- Aggregration Expression: $changeStream
-
allChangesForCluster
@MorphiaInternal public Boolean allChangesForCluster()
- Returns:
- internal
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
allChangesForCluster
public ChangeStream allChangesForCluster(Boolean allChangesForCluster)
Sets whether the change stream should include all changes in the cluster. May only be opened on the admin database.- Parameters:
allChangesForCluster
- true to get all changes- Returns:
- this
-
fullDocument
@MorphiaInternal public FullDocument fullDocument()
- Returns:
- internal
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
fullDocument
public ChangeStream fullDocument(FullDocument fullDocument)
Specifies whether change notifications include a copy of the full document when modified by update operations.- Parameters:
fullDocument
- the option to apply- Returns:
- this
-
fullDocumentBeforeChange
@MorphiaInternal public FullDocumentBeforeChange fullDocumentBeforeChange()
- Returns:
- internal
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
fullDocumentBeforeChange
public ChangeStream fullDocumentBeforeChange(FullDocumentBeforeChange fullDocumentBeforeChange)
Include the full document from before the change.- Parameters:
fullDocumentBeforeChange
- the option to apply- Returns:
- this
-
resumeAfter
@MorphiaInternal @Nullable public Document resumeAfter()
- Returns:
- internal
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
resumeAfter
public ChangeStream resumeAfter(Document resumeAfter)
Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields.- Parameters:
resumeAfter
- the token to resume after- Returns:
- thois
-
startAfter
@MorphiaInternal @Nullable public Document startAfter()
- Returns:
- internal
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
startAfter
public ChangeStream startAfter(Document startAfter)
Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields.- Parameters:
startAfter
- the token to start after- Returns:
- thois
-
startAtOperationTime
@MorphiaInternal @Nullable public LocalDateTime startAtOperationTime()
- Returns:
- internal
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
startAtOperationTime
public ChangeStream startAtOperationTime(LocalDateTime startAtOperationTime)
Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields.- Parameters:
startAtOperationTime
- the time to start after- Returns:
- this
-
-