Class AbstractReactiveMongoQuery

java.lang.Object
org.springframework.data.mongodb.repository.query.AbstractReactiveMongoQuery
All Implemented Interfaces:
org.springframework.data.repository.query.RepositoryQuery
Direct Known Subclasses:
ReactivePartTreeMongoQuery, ReactiveStringBasedAggregation, ReactiveStringBasedMongoQuery

public abstract class AbstractReactiveMongoQuery extends Object implements org.springframework.data.repository.query.RepositoryQuery
Base class for reactive RepositoryQuery implementations for MongoDB.
Since:
2.0
Author:
Mark Paluch, Christoph Strobl
  • Constructor Details

    • AbstractReactiveMongoQuery

      public AbstractReactiveMongoQuery(ReactiveMongoQueryMethod method, ReactiveMongoOperations operations, org.springframework.expression.ExpressionParser expressionParser, org.springframework.data.repository.query.ReactiveQueryMethodEvaluationContextProvider evaluationContextProvider)
      Parameters:
      method - must not be null.
      operations - must not be null.
      expressionParser - must not be null.
      evaluationContextProvider - must not be null.
  • Method Details

    • getQueryMethod

      public MongoQueryMethod getQueryMethod()
      Specified by:
      getQueryMethod in interface org.springframework.data.repository.query.RepositoryQuery
    • execute

      public org.reactivestreams.Publisher<Object> execute(Object[] parameters)
      Specified by:
      execute in interface org.springframework.data.repository.query.RepositoryQuery
    • doExecute

      protected org.reactivestreams.Publisher<Object> doExecute(ReactiveMongoQueryMethod method, org.springframework.data.repository.query.ResultProcessor processor, ConvertingParameterAccessor accessor, @Nullable Class<?> typeToRead)
      Execute the RepositoryQuery of the given method with the parameters provided by the accessor
      Parameters:
      method - the ReactiveMongoQueryMethod invoked. Never null.
      processor - ResultProcessor for post procession. Never null.
      accessor - for providing invocation arguments. Never null.
      typeToRead - the desired component target type. Can be null.
    • createCountQuery

      protected reactor.core.publisher.Mono<Query> createCountQuery(ConvertingParameterAccessor accessor)
      Creates a Query instance using the given ConvertingParameterAccessor. Will delegate to createQuery(ConvertingParameterAccessor) by default but allows customization of the count query to be triggered.
      Parameters:
      accessor - must not be null.
      Returns:
    • createUpdate

      protected reactor.core.publisher.Mono<UpdateDefinition> createUpdate(MongoParameterAccessor accessor)
      Retrieves the update from the given accessor or creates one via by parsing the annotated statement extracted from Update.
      Parameters:
      accessor - never null.
      Returns:
      the computed UpdateDefinition.
      Throws:
      IllegalStateException - if no update could be found.
      Since:
      3.4
    • parseAggregationPipeline

      protected reactor.core.publisher.Mono<List<AggregationOperation>> parseAggregationPipeline(String[] pipeline, MongoParameterAccessor accessor)
      Parse the given aggregation pipeline stages applying values to placeholders to compute the actual list of operations.
      Parameters:
      pipeline - must not be null.
      accessor - must not be null.
      Returns:
      the parsed aggregation pipeline.
      Since:
      3.4
    • getParameterBindingCodec

      protected reactor.core.publisher.Mono<ParameterBindingDocumentCodec> getParameterBindingCodec()
      Obtain the ParameterBindingDocumentCodec used for parsing JSON expressions.
      Returns:
      never null.
      Since:
      3.4
    • getSpelEvaluatorFor

      protected reactor.core.publisher.Mono<org.springframework.data.mapping.model.SpELExpressionEvaluator> getSpelEvaluatorFor(org.springframework.data.spel.ExpressionDependencies dependencies, MongoParameterAccessor accessor)
      Obtain a publisher emitting the SpELExpressionEvaluator suitable to evaluate expressions backed by the given dependencies.
      Parameters:
      dependencies - must not be null.
      accessor - must not be null.
      Returns:
      a Mono emitting the SpELExpressionEvaluator when ready.
      Since:
      3.4
    • getCodecRegistry

      protected reactor.core.publisher.Mono<org.bson.codecs.configuration.CodecRegistry> getCodecRegistry()
      Returns:
      a Mono emitting the CodecRegistry when ready.
      Since:
      2.4
    • createQuery

      protected abstract reactor.core.publisher.Mono<Query> createQuery(ConvertingParameterAccessor accessor)
      Creates a Query instance using the given ParameterAccessor
      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