Class ChangeStreamOptions.ChangeStreamOptionsBuilder
java.lang.Object
org.springframework.data.mongodb.core.ChangeStreamOptions.ChangeStreamOptionsBuilder
- Enclosing class:
ChangeStreamOptions
Builder for creating
ChangeStreamOptions.- Since:
- 2.1
- Author:
- Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Set the collation to use.filter(org.bson.Document... filter) Set the plain filter chain to apply.filter(Aggregation filter) Set the filter to apply.fullDocumentBeforeChangeLookup(com.mongodb.client.model.changestream.FullDocumentBeforeChange lookup) Set theFullDocumentBeforeChangelookup to use.fullDocumentLookup(com.mongodb.client.model.changestream.FullDocument lookup) Set theFullDocumentlookup to use.resumeAfter(org.bson.BsonValue resumeToken) Set the resume token after which to continue emitting notifications.Set the cluster time to resume from.resumeAt(org.bson.BsonTimestamp resumeTimestamp) Set the cluster time to resume from.resumeToken(org.bson.BsonValue resumeToken) Set the resume token (typically aBsonDocumentcontaining abinary token) after which to start with listening.Return the full document before being changed if it is available.Set theFullDocumentlookup toFullDocument.UPDATE_LOOKUP.startAfter(org.bson.BsonValue resumeToken) Set the resume token after which to start emitting notifications.
-
Method Details
-
collation
@Contract("_ -> this") public ChangeStreamOptions.ChangeStreamOptionsBuilder collation(Collation collation) Set the collation to use.- Parameters:
collation- must not be null nor empty.- Returns:
- this.
-
filter
@Contract("_ -> this") public ChangeStreamOptions.ChangeStreamOptionsBuilder filter(Aggregation filter) Set the filter to apply.
Fields on aggregation expression root level are prefixed to map to fields contained infullDocument. However operationType, ns, documentKey and fullDocument are reserved words that will be omitted, and therefore taken as given, during the mapping procedure. You may want to have a look at the structure of Change Events.
UseTypedAggregationto ensure filter expressions are mapped to domain type fields.- Parameters:
filter- theAggregation pipelineto apply for filtering events. Must not be null.- Returns:
- this.
-
filter
@Contract("_ -> this") public ChangeStreamOptions.ChangeStreamOptionsBuilder filter(org.bson.Document... filter) Set the plain filter chain to apply.- Parameters:
filter- must not be null nor contain null values.- Returns:
- this.
-
resumeToken
@Contract("_ -> this") public ChangeStreamOptions.ChangeStreamOptionsBuilder resumeToken(org.bson.BsonValue resumeToken) Set the resume token (typically aBsonDocumentcontaining abinary token) after which to start with listening.- Parameters:
resumeToken- must not be null.- Returns:
- this.
-
returnFullDocumentOnUpdate
Set theFullDocumentlookup toFullDocument.UPDATE_LOOKUP.- Returns:
- this.
- See Also:
-
fullDocumentLookup
@Contract("_ -> this") public ChangeStreamOptions.ChangeStreamOptionsBuilder fullDocumentLookup(com.mongodb.client.model.changestream.FullDocument lookup) Set theFullDocumentlookup to use.- Parameters:
lookup- must not be null.- Returns:
- this.
-
fullDocumentBeforeChangeLookup
@Contract("_ -> this") public ChangeStreamOptions.ChangeStreamOptionsBuilder fullDocumentBeforeChangeLookup(com.mongodb.client.model.changestream.FullDocumentBeforeChange lookup) Set theFullDocumentBeforeChangelookup to use.- Parameters:
lookup- must not be null.- Returns:
- this.
- Since:
- 4.0
-
returnFullDocumentBeforeChange
Return the full document before being changed if it is available.- Returns:
- this.
- Since:
- 4.0
- See Also:
-
resumeAt
@Contract("_ -> this") public ChangeStreamOptions.ChangeStreamOptionsBuilder resumeAt(Instant resumeTimestamp) Set the cluster time to resume from.- Parameters:
resumeTimestamp- must not be null.- Returns:
- this.
-
resumeAt
@Contract("_ -> this") public ChangeStreamOptions.ChangeStreamOptionsBuilder resumeAt(org.bson.BsonTimestamp resumeTimestamp) Set the cluster time to resume from.- Parameters:
resumeTimestamp- must not be null.- Returns:
- this.
- Since:
- 2.2
-
resumeAfter
@Contract("_ -> this") public ChangeStreamOptions.ChangeStreamOptionsBuilder resumeAfter(org.bson.BsonValue resumeToken) Set the resume token after which to continue emitting notifications.- Parameters:
resumeToken- must not be null.- Returns:
- this.
- Since:
- 2.2
-
startAfter
@Contract("_ -> this") public ChangeStreamOptions.ChangeStreamOptionsBuilder startAfter(org.bson.BsonValue resumeToken) Set the resume token after which to start emitting notifications.- Parameters:
resumeToken- must not be null.- Returns:
- this.
- Since:
- 2.2
-
build
- Returns:
- the built
ChangeStreamOptions
-