Class AbstractReactiveMongoQuery
java.lang.Object
org.springframework.data.mongodb.repository.query.AbstractReactiveMongoQuery
- All Implemented Interfaces:
RepositoryQuery
- Direct Known Subclasses:
ReactivePartTreeMongoQuery,ReactiveStringBasedAggregation,ReactiveStringBasedMongoQuery,ReactiveVectorSearchAggregation
Base class for reactive
RepositoryQuery implementations for MongoDB.- Since:
- 2.0
- Author:
- Mark Paluch, Christoph Strobl, Jorge RodrÃguez
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractReactiveMongoQuery(ReactiveMongoQueryMethod method, ReactiveMongoOperations operations, ValueExpressionDelegate delegate) -
Method Summary
Modifier and TypeMethodDescriptioncreateCountQuery(ConvertingParameterAccessor accessor) Creates aQueryinstance using the givenConvertingParameterAccessor.createQuery(ConvertingParameterAccessor accessor) Creates aQueryinstance using the givenParameterAccessorprotected Mono<UpdateDefinition>createUpdate(MongoParameterAccessor accessor) doExecute(ReactiveMongoQueryMethod method, ResultProcessor processor, ConvertingParameterAccessor accessor, @Nullable Class<?> typeToRead) Execute theRepositoryQueryof the given method with the parameters provided by theaccessorprotected Mono<org.bson.codecs.configuration.CodecRegistry>protected Mono<ParameterBindingDocumentCodec>Obtain theParameterBindingDocumentCodecused for parsing JSON expressions.protected Mono<ValueExpressionEvaluator>getValueExpressionEvaluatorLater(ExpressionDependencies dependencies, MongoParameterAccessor accessor) Obtain apublisheremitting theValueExpressionEvaluatorsuitable to evaluate expressions backed by the given dependencies.protected abstract booleanReturns whether the query should get a count projection applied.protected abstract booleanReturn weather the query should delete matching documents.protected abstract booleanReturns whether the query should get an exists projection applied.protected abstract booleanReturn whether the query has an explicit limit set.protected Mono<List<AggregationOperation>>parseAggregationPipeline(String[] pipeline, MongoParameterAccessor accessor) Parse the given aggregation pipeline stages applying values to placeholders to compute the actual list ofoperations.
-
Constructor Details
-
AbstractReactiveMongoQuery
public AbstractReactiveMongoQuery(ReactiveMongoQueryMethod method, ReactiveMongoOperations operations, ValueExpressionDelegate delegate) - Parameters:
method- must not be null.operations- must not be null.delegate- must not be null.- Since:
- 4.4.0
-
-
Method Details
-
getQueryMethod
- Specified by:
getQueryMethodin interfaceRepositoryQuery
-
execute
- Specified by:
executein interfaceRepositoryQuery
-
doExecute
protected Publisher<Object> doExecute(ReactiveMongoQueryMethod method, ResultProcessor processor, ConvertingParameterAccessor accessor, @Nullable Class<?> typeToRead) Execute theRepositoryQueryof the given method with the parameters provided by theaccessor- Parameters:
method- theReactiveMongoQueryMethodinvoked. Never null.processor-ResultProcessorfor post procession. Never null.accessor- for providing invocation arguments. Never null.typeToRead- the desired component target type. Can be null.
-
createCountQuery
Creates aQueryinstance using the givenConvertingParameterAccessor. Will delegate tocreateQuery(ConvertingParameterAccessor)by default but allows customization of the count query to be triggered.- Parameters:
accessor- must not be null.- Returns:
-
createUpdate
Retrieves theupdatefrom the givenaccessoror creates one via by parsing the annotated statement extracted fromUpdate.- Parameters:
accessor- never null.- Returns:
- the computed
UpdateDefinition. - Throws:
IllegalStateException- if no update could be found.- Since:
- 3.4
-
parseAggregationPipeline
protected Mono<List<AggregationOperation>> parseAggregationPipeline(String[] pipeline, MongoParameterAccessor accessor) Parse the given aggregation pipeline stages applying values to placeholders to compute the actual list ofoperations.- Parameters:
pipeline- must not be null.accessor- must not be null.- Returns:
- the parsed aggregation pipeline.
- Since:
- 3.4
-
getParameterBindingCodec
Obtain theParameterBindingDocumentCodecused for parsing JSON expressions.- Returns:
- never null.
- Since:
- 3.4
-
getValueExpressionEvaluatorLater
protected Mono<ValueExpressionEvaluator> getValueExpressionEvaluatorLater(ExpressionDependencies dependencies, MongoParameterAccessor accessor) Obtain apublisheremitting theValueExpressionEvaluatorsuitable to evaluate expressions backed by the given dependencies.- Parameters:
dependencies- must not be null.accessor- must not be null.- Returns:
- a
Monoemitting theValueExpressionEvaluatorwhen ready. - Since:
- 4.3
-
getCodecRegistry
- Returns:
- a
Monoemitting theCodecRegistrywhen ready. - Since:
- 2.4
-
createQuery
Creates aQueryinstance using the givenParameterAccessor- Parameters:
accessor- must not be null.- Returns:
-
isCountQuery
protected abstract boolean isCountQuery()Returns whether the query should get a count projection applied.- Returns:
-
isExistsQuery
protected abstract boolean isExistsQuery()Returns whether the query should get an exists projection applied.- Returns:
- Since:
- 2.0.9
-
isDeleteQuery
protected abstract boolean isDeleteQuery()Return weather the query should delete matching documents.- Returns:
- Since:
- 1.5
-
isLimiting
protected abstract boolean isLimiting()Return whether the query has an explicit limit set.- Returns:
- Since:
- 2.0.4
-