Class AbstractFetchableMongodbQuery<K,​Q extends AbstractFetchableMongodbQuery<K,​Q>>

  • Type Parameters:
    K - result type
    Q - concrete subtype
    All Implemented Interfaces:
    Fetchable<K>, FilteredClause<Q>, SimpleQuery<Q>

    public abstract class AbstractFetchableMongodbQuery<K,​Q extends AbstractFetchableMongodbQuery<K,​Q>>
    extends AbstractMongodbQuery<Q>
    implements Fetchable<K>
    Fetchable Mongodb query with a pluggable Document to Bean transformation.
    Author:
    Mark Paluch
    • Constructor Detail

      • AbstractFetchableMongodbQuery

        public AbstractFetchableMongodbQuery​(com.mongodb.client.MongoCollection<org.bson.Document> collection,
                                             java.util.function.Function<org.bson.Document,​K> transformer,
                                             MongodbDocumentSerializer serializer)
        Create a new MongodbQuery instance
        Parameters:
        collection -
        transformer - result transformer
        serializer - serializer
    • Method Detail

      • iterate

        public com.mysema.commons.lang.CloseableIterator<K> iterate​(Path<?>... paths)
        Iterate with the specific fields
        Parameters:
        paths - fields to return
        Returns:
        iterator
      • iterate

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

        public java.util.List<K> fetch​(Path<?>... paths)
        Fetch with the specific fields
        Parameters:
        paths - fields to return
        Returns:
        results
      • fetch

        public java.util.List<K> fetch()
        Specified by:
        fetch in interface Fetchable<K>
      • fetchFirst

        public K fetchFirst​(Path<?>... paths)
        Fetch first with the specific fields
        Parameters:
        paths - fields to return
        Returns:
        first result
      • fetchOne

        public K fetchOne​(Path<?>... paths)
        Fetch one with the specific fields
        Parameters:
        paths - fields to return
        Returns:
        first result
      • fetchResults

        public QueryResults<K> fetchResults​(Path<?>... paths)
        Fetch results with the specific fields
        Parameters:
        paths - fields to return
        Returns:
        results
      • createCursor

        protected com.mongodb.client.FindIterable<org.bson.Document> createCursor()
      • createCursor

        protected com.mongodb.client.FindIterable<org.bson.Document> createCursor​(com.mongodb.client.MongoCollection<org.bson.Document> collection,
                                                                                  @Nullable
                                                                                  @Nullable Predicate where,
                                                                                  Expression<?> projection,
                                                                                  QueryModifiers modifiers,
                                                                                  java.util.List<OrderSpecifier<?>> orderBy)
      • getCollection

        protected abstract com.mongodb.client.MongoCollection<org.bson.Document> getCollection​(java.lang.Class<?> type)