|
17 | 17 |
|
18 | 18 | import reactor.core.publisher.Flux;
|
19 | 19 | import reactor.core.publisher.Mono;
|
20 |
| -import reactor.util.function.Tuple2; |
21 | 20 |
|
22 | 21 | import java.util.ArrayList;
|
23 | 22 | import java.util.List;
|
24 | 23 |
|
25 | 24 | import org.bson.Document;
|
26 | 25 | import org.bson.codecs.configuration.CodecRegistry;
|
27 | 26 | import org.reactivestreams.Publisher;
|
| 27 | + |
28 | 28 | import org.springframework.core.convert.converter.Converter;
|
29 | 29 | import org.springframework.data.mapping.model.EntityInstantiators;
|
30 | 30 | import org.springframework.data.mapping.model.SpELExpressionEvaluator;
|
@@ -231,7 +231,6 @@ private boolean isTailable(MongoQueryMethod method) {
|
231 | 231 | return method.getTailableAnnotation() != null;
|
232 | 232 | }
|
233 | 233 |
|
234 |
| - |
235 | 234 | Query applyQueryMetaAttributesWhenPresent(Query query) {
|
236 | 235 |
|
237 | 236 | if (method.hasQueryMetaAttributes()) {
|
@@ -290,7 +289,8 @@ Query applyHintIfPresent(Query query) {
|
290 | 289 | }
|
291 | 290 |
|
292 | 291 | /**
|
293 |
| - * If present apply the {@link com.mongodb.ReadPreference} from the {@link org.springframework.data.mongodb.repository.ReadPreference} annotation. |
| 292 | + * If present apply the {@link com.mongodb.ReadPreference} from the |
| 293 | + * {@link org.springframework.data.mongodb.repository.ReadPreference} annotation. |
294 | 294 | *
|
295 | 295 | * @param query must not be {@literal null}.
|
296 | 296 | * @return never {@literal null}.
|
@@ -339,8 +339,8 @@ protected Mono<UpdateDefinition> createUpdate(MongoParameterAccessor accessor) {
|
339 | 339 |
|
340 | 340 | String updateJson = updateSource.update();
|
341 | 341 | return getParameterBindingCodec() //
|
342 |
| - .flatMap(codec -> expressionEvaluator(updateJson, accessor, codec)) // |
343 |
| - .map(it -> decode(it.getT1(), updateJson, accessor, it.getT2())) // |
| 342 | + .flatMap(codec -> expressionEvaluator(updateJson, accessor, codec) // |
| 343 | + .map(evaluator -> decode(evaluator, updateJson, accessor, codec))) // |
344 | 344 | .map(BasicUpdate::fromDocument);
|
345 | 345 | }
|
346 | 346 | if (!ObjectUtils.isEmpty(updateSource.pipeline())) {
|
@@ -376,16 +376,17 @@ protected Mono<List<AggregationOperation>> parseAggregationPipeline(String[] pip
|
376 | 376 | private Mono<AggregationOperation> computePipelineStage(String source, MongoParameterAccessor accessor,
|
377 | 377 | ParameterBindingDocumentCodec codec) {
|
378 | 378 |
|
379 |
| - return expressionEvaluator(source, accessor, codec).map( |
380 |
| - it -> new StringAggregationOperation(source, AbstractReactiveMongoQuery.this.getQueryMethod().getDomainClass(), bsonString -> AbstractReactiveMongoQuery.this.decode(it.getT1(), bsonString, accessor, it.getT2()))); |
| 379 | + return expressionEvaluator(source, accessor, codec).map(evaluator -> new StringAggregationOperation(source, |
| 380 | + AbstractReactiveMongoQuery.this.getQueryMethod().getDomainClass(), |
| 381 | + bsonString -> AbstractReactiveMongoQuery.this.decode(evaluator, bsonString, accessor, codec))); |
381 | 382 | }
|
382 | 383 |
|
383 |
| - private Mono<Tuple2<SpELExpressionEvaluator, ParameterBindingDocumentCodec>> expressionEvaluator(String source, |
384 |
| - MongoParameterAccessor accessor, ParameterBindingDocumentCodec codec) { |
| 384 | + private Mono<SpELExpressionEvaluator> expressionEvaluator(String source, MongoParameterAccessor accessor, |
| 385 | + ParameterBindingDocumentCodec codec) { |
385 | 386 |
|
386 | 387 | ExpressionDependencies dependencies = codec.captureExpressionDependencies(source, accessor::getBindableValue,
|
387 | 388 | expressionParser);
|
388 |
| - return getSpelEvaluatorFor(dependencies, accessor).zipWith(Mono.just(codec)); |
| 389 | + return getSpelEvaluatorFor(dependencies, accessor); |
389 | 390 | }
|
390 | 391 |
|
391 | 392 | private Document decode(SpELExpressionEvaluator expressionEvaluator, String source, MongoParameterAccessor accessor,
|
|
0 commit comments