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

java.lang.Object
com.querydsl.mongodb.document.AbstractMongodbQuery<Q>
com.querydsl.mongodb.document.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 Details

    • AbstractFetchableMongodbQuery

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

    • 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 List<K> fetch(Path<?>... paths)
      Fetch with the specific fields
      Parameters:
      paths - fields to return
      Returns:
      results
    • fetch

      public 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
    • fetchFirst

      public K fetchFirst()
      Specified by:
      fetchFirst in interface Fetchable<K>
    • fetchOne

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

      public K fetchOne()
      Specified by:
      fetchOne in interface Fetchable<K>
    • fetchResults

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

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

      public long fetchCount()
      Specified by:
      fetchCount in interface Fetchable<K>
    • 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, List<OrderSpecifier<?>> orderBy)
    • getCollection

      protected abstract com.mongodb.client.MongoCollection<org.bson.Document> getCollection(Class<?> type)
    • getIds

      protected List<Object> getIds(Class<?> targetType, Predicate condition)
      Specified by:
      getIds in class AbstractMongodbQuery<Q extends AbstractFetchableMongodbQuery<K,Q>>