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
  • Method Details

    • 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 Pipeline Stage: $changeStream
    • 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

      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

      public ChangeStream fullDocumentBeforeChange(FullDocumentBeforeChange fullDocumentBeforeChange)
      Include the full document from before the change.
      Parameters:
      fullDocumentBeforeChange - the option to apply
      Returns:
      this
    • 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:
      this
    • 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:
      this
    • 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