K - result typeQ - concrete subtypepublic abstract class AbstractMongodbQuery<K,Q extends AbstractMongodbQuery<K,Q>> extends Object implements SimpleQuery<Q>, Fetchable<K>
AbstractMongodbQuery provides a base class for general Querydsl query implementation with a
pluggable DBObject to Bean transformation| Constructor and Description |
|---|
AbstractMongodbQuery(com.mongodb.DBCollection collection,
com.google.common.base.Function<com.mongodb.DBObject,K> transformer,
MongodbSerializer serializer)
Create a new MongodbQuery instance
|
| Modifier and Type | Method and Description |
|---|---|
<T> AnyEmbeddedBuilder<Q,K> |
anyEmbedded(Path<? extends Collection<T>> collection,
Path<T> target)
Define a constraint for an embedded object
|
com.mongodb.DBObject |
asDBObject()
Get the where definition as a DBObject instance
|
protected com.mongodb.DBCursor |
createCursor() |
protected com.mongodb.DBCursor |
createCursor(com.mongodb.DBCollection collection,
Predicate where,
Expression<?> projection,
QueryModifiers modifiers,
List<OrderSpecifier<?>> orderBy) |
protected Predicate |
createFilter(QueryMetadata metadata) |
protected Predicate |
createJoinFilter(QueryMetadata metadata) |
Q |
distinct() |
List<K> |
fetch() |
List<K> |
fetch(Path<?>... paths)
Fetch with the specific fields
|
long |
fetchCount() |
K |
fetchFirst() |
K |
fetchFirst(Path<?>... paths)
Fetch first with the specific fields
|
K |
fetchOne() |
K |
fetchOne(Path<?>... paths)
Fetch one with the specific fields
|
QueryResults<K> |
fetchResults() |
QueryResults<K> |
fetchResults(Path<?>... paths)
Fetch results with the specific fields
|
protected abstract com.mongodb.DBCollection |
getCollection(Class<?> type) |
protected List<Object> |
getIds(Class<?> targetType,
Predicate condition) |
com.mysema.commons.lang.CloseableIterator<K> |
iterate() |
com.mysema.commons.lang.CloseableIterator<K> |
iterate(Path<?>... paths)
Iterate with the specific fields
|
<T> JoinBuilder<Q,K,T> |
join(CollectionPathBase<?,T,?> ref,
Path<T> target)
Define a join
|
<T> JoinBuilder<Q,K,T> |
join(Path<T> ref,
Path<T> target)
Define a join
|
Q |
limit(long limit) |
Q |
offset(long offset) |
Q |
orderBy(OrderSpecifier<?>... o) |
Q |
orderBy(OrderSpecifier<?> o) |
Q |
restrict(QueryModifiers modifiers) |
<T> Q |
set(ParamExpression<T> param,
T value) |
void |
setReadPreference(com.mongodb.ReadPreference readPreference)
Sets the read preference for this query
|
String |
toString() |
Q |
where(Predicate... e) |
Q |
where(Predicate e) |
public AbstractMongodbQuery(com.mongodb.DBCollection collection,
com.google.common.base.Function<com.mongodb.DBObject,K> transformer,
MongodbSerializer serializer)
collection - collectiontransformer - result transformerserializer - serializerpublic <T> JoinBuilder<Q,K,T> join(Path<T> ref, Path<T> target)
ref - referencetarget - join targetpublic <T> JoinBuilder<Q,K,T> join(CollectionPathBase<?,T,?> ref, Path<T> target)
ref - referencetarget - join targetpublic <T> AnyEmbeddedBuilder<Q,K> anyEmbedded(Path<? extends Collection<T>> collection, Path<T> target)
collection - collectiontarget - targetprotected abstract com.mongodb.DBCollection getCollection(Class<?> type)
@Nullable protected Predicate createFilter(QueryMetadata metadata)
@Nullable protected Predicate createJoinFilter(QueryMetadata metadata)
public Q distinct()
distinct in interface SimpleQuery<Q extends AbstractMongodbQuery<K,Q>>public Q where(Predicate... e)
where in interface FilteredClause<Q extends AbstractMongodbQuery<K,Q>>public Q limit(long limit)
limit in interface SimpleQuery<Q extends AbstractMongodbQuery<K,Q>>public Q offset(long offset)
offset in interface SimpleQuery<Q extends AbstractMongodbQuery<K,Q>>public Q restrict(QueryModifiers modifiers)
restrict in interface SimpleQuery<Q extends AbstractMongodbQuery<K,Q>>public Q orderBy(OrderSpecifier<?> o)
public Q orderBy(OrderSpecifier<?>... o)
orderBy in interface SimpleQuery<Q extends AbstractMongodbQuery<K,Q>>public <T> Q set(ParamExpression<T> param, T value)
set in interface SimpleQuery<Q extends AbstractMongodbQuery<K,Q>>public com.mysema.commons.lang.CloseableIterator<K> iterate(Path<?>... paths)
paths - fields to returnpublic com.mysema.commons.lang.CloseableIterator<K> iterate()
public List<K> fetch(Path<?>... paths)
paths - fields to returnprotected com.mongodb.DBCursor createCursor()
protected com.mongodb.DBCursor createCursor(com.mongodb.DBCollection collection,
@Nullable
Predicate where,
Expression<?> projection,
QueryModifiers modifiers,
List<OrderSpecifier<?>> orderBy)
public K fetchFirst(Path<?>... paths)
paths - fields to returnpublic K fetchFirst()
fetchFirst in interface Fetchable<K>public K fetchOne(Path<?>... paths)
paths - fields to returnpublic K fetchOne() throws NonUniqueResultException
fetchOne in interface Fetchable<K>NonUniqueResultExceptionpublic QueryResults<K> fetchResults(Path<?>... paths)
paths - fields to returnpublic QueryResults<K> fetchResults()
fetchResults in interface Fetchable<K>public long fetchCount()
fetchCount in interface Fetchable<K>public void setReadPreference(com.mongodb.ReadPreference readPreference)
readPreference - read preferencepublic com.mongodb.DBObject asDBObject()
Copyright © 2007–2019 Querydsl. All rights reserved.