@ -53,6 +53,7 @@ public class ChangeStreamOptions {
@@ -53,6 +53,7 @@ public class ChangeStreamOptions {
private @Nullable FullDocumentBeforeChange fullDocumentBeforeChangeLookup ;
private @Nullable Collation collation ;
private @Nullable Object resumeTimestamp ;
private @Nullable Boolean showExpandedEvents ;
private Resume resume = Resume . UNDEFINED ;
protected ChangeStreamOptions ( ) { }
@ -108,6 +109,13 @@ public class ChangeStreamOptions {
@@ -108,6 +109,13 @@ public class ChangeStreamOptions {
return Optional . ofNullable ( resumeTimestamp ) . map ( timestamp - > asTimestampOfType ( timestamp , BsonTimestamp . class ) ) ;
}
/ * *
* @return { @link Optional # empty ( ) } if not set .
* /
public Optional < Boolean > getShowExpandedEvents ( ) {
return Optional . ofNullable ( showExpandedEvents ) ;
}
/ * *
* @return { @literal true } if the change stream should be started after the { @link # getResumeToken ( ) token } .
* @since 2 . 2
@ -191,6 +199,9 @@ public class ChangeStreamOptions {
@@ -191,6 +199,9 @@ public class ChangeStreamOptions {
if ( ! ObjectUtils . nullSafeEquals ( this . resumeTimestamp , that . resumeTimestamp ) ) {
return false ;
}
if ( ! ObjectUtils . nullSafeEquals ( this . showExpandedEvents , that . showExpandedEvents ) ) {
return false ;
}
return resume = = that . resume ;
}
@ -202,6 +213,7 @@ public class ChangeStreamOptions {
@@ -202,6 +213,7 @@ public class ChangeStreamOptions {
result = 31 * result + ObjectUtils . nullSafeHashCode ( fullDocumentBeforeChangeLookup ) ;
result = 31 * result + ObjectUtils . nullSafeHashCode ( collation ) ;
result = 31 * result + ObjectUtils . nullSafeHashCode ( resumeTimestamp ) ;
result = 31 * result + ObjectUtils . nullSafeHashCode ( showExpandedEvents ) ;
result = 31 * result + ObjectUtils . nullSafeHashCode ( resume ) ;
return result ;
}
@ -239,6 +251,7 @@ public class ChangeStreamOptions {
@@ -239,6 +251,7 @@ public class ChangeStreamOptions {
private @Nullable FullDocumentBeforeChange fullDocumentBeforeChangeLookup ;
private @Nullable Collation collation ;
private @Nullable Object resumeTimestamp ;
private @Nullable Boolean showExpandedEvents ;
private Resume resume = Resume . UNDEFINED ;
private ChangeStreamOptionsBuilder ( ) { }
@ -432,6 +445,19 @@ public class ChangeStreamOptions {
@@ -432,6 +445,19 @@ public class ChangeStreamOptions {
return this ;
}
/ * *
* Set whether expanded change events ( e . g . createIndexes , shardCollection ) should be emitted .
*
* @param showExpandedEvents { @code true } to include expanded events .
* @return this .
* /
@Contract ( "_ -> this" )
public ChangeStreamOptionsBuilder showExpandedEvents ( boolean showExpandedEvents ) {
this . showExpandedEvents = showExpandedEvents ;
return this ;
}
/ * *
* @return the built { @link ChangeStreamOptions }
* /
@ -446,6 +472,7 @@ public class ChangeStreamOptions {
@@ -446,6 +472,7 @@ public class ChangeStreamOptions {
options . fullDocumentBeforeChangeLookup = this . fullDocumentBeforeChangeLookup ;
options . collation = this . collation ;
options . resumeTimestamp = this . resumeTimestamp ;
options . showExpandedEvents = this . showExpandedEvents ;
options . resume = this . resume ;
return options ;