|
37 | 37 | import org.springframework.data.mongodb.core.aggregation.TypedAggregation;
|
38 | 38 | import org.springframework.data.mongodb.core.convert.MongoConverter;
|
39 | 39 | import org.springframework.data.mongodb.core.convert.QueryMapper;
|
40 |
| -import org.springframework.data.mongodb.core.messaging.ChangeStreamRequest.ChangeStreamRequestOptions; |
41 | 40 | import org.springframework.data.mongodb.core.messaging.Message.MessageProperties;
|
42 | 41 | import org.springframework.data.mongodb.core.messaging.SubscriptionRequest.RequestOptions;
|
43 | 42 | import org.springframework.lang.Nullable;
|
@@ -88,7 +87,7 @@ protected MongoCursor<ChangeStreamDocument<Document>> initCursor(MongoTemplate t
|
88 | 87 | Collation collation = null;
|
89 | 88 | FullDocument fullDocument = ClassUtils.isAssignable(Document.class, targetType) ? FullDocument.DEFAULT
|
90 | 89 | : FullDocument.UPDATE_LOOKUP;
|
91 |
| - FullDocumentBeforeChange fullDocumentBeforeChange = FullDocumentBeforeChange.DEFAULT; |
| 90 | + FullDocumentBeforeChange fullDocumentBeforeChange = null; |
92 | 91 | BsonTimestamp startAt = null;
|
93 | 92 | boolean resumeAfter = true;
|
94 | 93 |
|
@@ -116,8 +115,9 @@ protected MongoCursor<ChangeStreamDocument<Document>> initCursor(MongoTemplate t
|
116 | 115 | .orElseGet(() -> ClassUtils.isAssignable(Document.class, targetType) ? FullDocument.DEFAULT
|
117 | 116 | : FullDocument.UPDATE_LOOKUP);
|
118 | 117 |
|
119 |
| - fullDocumentBeforeChange = changeStreamOptions.getFullDocumentBeforeChangeLookup() |
120 |
| - .orElse(FullDocumentBeforeChange.DEFAULT); |
| 118 | + if(changeStreamOptions.getFullDocumentBeforeChangeLookup().isPresent()) { |
| 119 | + fullDocumentBeforeChange = changeStreamOptions.getFullDocumentBeforeChangeLookup().get(); |
| 120 | + } |
121 | 121 |
|
122 | 122 | startAt = changeStreamOptions.getResumeBsonTimestamp().orElse(null);
|
123 | 123 | }
|
@@ -158,7 +158,9 @@ protected MongoCursor<ChangeStreamDocument<Document>> initCursor(MongoTemplate t
|
158 | 158 | }
|
159 | 159 |
|
160 | 160 | iterable = iterable.fullDocument(fullDocument);
|
161 |
| - iterable = iterable.fullDocumentBeforeChange(fullDocumentBeforeChange); |
| 161 | + if(fullDocumentBeforeChange != null) { |
| 162 | + iterable = iterable.fullDocumentBeforeChange(fullDocumentBeforeChange); |
| 163 | + } |
162 | 164 |
|
163 | 165 | return iterable.iterator();
|
164 | 166 | }
|
|
0 commit comments