org.springframework.data.mongodb.repository.support

Class SpringDataMongodbQuery<T>

  • All Implemented Interfaces:
    com.querydsl.core.Fetchable<T>, com.querydsl.core.FilteredClause<SpringDataMongodbQuery<T>>, com.querydsl.core.SimpleQuery<SpringDataMongodbQuery<T>>


    public class SpringDataMongodbQuery<T>
    extends QuerydslAbstractMongodbQuery<K,Q>
    Spring Data specific simple Fetchable Query implementation.
    Author:
    Oliver Gierke, Mark Paluch, Christoph Strobl
    • Constructor Detail

      • SpringDataMongodbQuery

        public SpringDataMongodbQuery(MongoOperations operations,
                                      Class<? extends T> type)
        Creates a new SpringDataMongodbQuery.
        Parameters:
        operations - must not be null.
        type - must not be null.
      • SpringDataMongodbQuery

        public SpringDataMongodbQuery(MongoOperations operations,
                                      Class<? extends T> type,
                                      String collectionName)
        Creates a new SpringDataMongodbQuery to query the given collection.
        Parameters:
        operations - must not be null.
        type - must not be null.
        collectionName - must not be null or empty.
    • Method Detail

      • iterate

        public com.mysema.commons.lang.CloseableIterator<K> iterate()
        Specified by:
        iterate in interface com.querydsl.core.Fetchable<K>
      • fetch

        public List<K> fetch()
        Specified by:
        fetch in interface com.querydsl.core.Fetchable<K>
      • fetchFirst

        public K fetchFirst()
        Specified by:
        fetchFirst in interface com.querydsl.core.Fetchable<K>
      • fetchOne

        public K fetchOne()
        Specified by:
        fetchOne in interface com.querydsl.core.Fetchable<K>
      • fetchResults

        public com.querydsl.core.QueryResults<K> fetchResults()
        Specified by:
        fetchResults in interface com.querydsl.core.Fetchable<K>
      • fetchCount

        public long fetchCount()
        Specified by:
        fetchCount in interface com.querydsl.core.Fetchable<K>
      • join

        public <T> QuerydslJoinBuilder<Q,K,T> join(com.querydsl.core.types.Path<T> ref,
                                                   com.querydsl.core.types.Path<T> target)
        Define a join.
        Parameters:
        ref - reference
        target - join target
        Returns:
        new instance of QuerydslJoinBuilder.
      • join

        public <T> QuerydslJoinBuilder<Q,K,T> join(com.querydsl.core.types.dsl.CollectionPathBase<?,T,?> ref,
                                                   com.querydsl.core.types.Path<T> target)
        Define a join.
        Parameters:
        ref - reference
        target - join target
        Returns:
        new instance of QuerydslJoinBuilder.
      • anyEmbedded

        public <T> QuerydslAnyEmbeddedBuilder<Q,K> anyEmbedded(com.querydsl.core.types.Path<? extends Collection<T>> collection,
                                                               com.querydsl.core.types.Path<T> target)
        Define a constraint for an embedded object.
        Parameters:
        collection - collection must not be null.
        target - target must not be null.
        Returns:
        new instance of QuerydslAnyEmbeddedBuilder.
      • createQuery

        protected Query createQuery()
      • createQuery

        protected Query createQuery(@Nullable
                                    com.querydsl.core.types.Predicate filter,
                                    @Nullable
                                    com.querydsl.core.types.Expression<?> projection,
                                    com.querydsl.core.QueryModifiers modifiers,
                                    List<com.querydsl.core.types.OrderSpecifier<?>> orderBy)
      • createFilter

        @Nullable
        protected com.querydsl.core.types.Predicate createFilter(com.querydsl.core.QueryMetadata metadata)
      • createJoinFilter

        @Nullable
        protected com.querydsl.core.types.Predicate createJoinFilter(com.querydsl.core.QueryMetadata metadata)
      • getIds

        protected List<Object> getIds(Class<?> targetType,
                                      com.querydsl.core.types.Predicate condition)
        Fetch the list of ids matching a given condition.
        Parameters:
        targetType - must not be null.
        condition - must not be null.
        Returns:
        empty List if none found.