K - public abstract class MongodbQuery<K> extends Object implements SimpleQuery<MongodbQuery<K>>, SimpleProjectable<K>
| Constructor and Description |
|---|
MongodbQuery(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<K> |
anyEmbedded(Path<? extends Collection<T>> collection,
Path<T> target)
Define a constraint for an embedded object
|
long |
count()
Get the count of matched elements
|
protected com.mongodb.DBCursor |
createCursor() |
protected com.mongodb.DBCursor |
createCursor(com.mongodb.DBCollection collection,
Predicate where,
List<Expression<?>> projection,
QueryModifiers modifiers,
List<OrderSpecifier<?>> orderBy) |
protected Predicate |
createFilter(QueryMetadata metadata) |
protected Predicate |
createJoinFilter(QueryMetadata metadata) |
MongodbQuery<K> |
distinct()
Set the Query to return distinct results
|
boolean |
exists() |
protected abstract com.mongodb.DBCollection |
getCollection(Class<?> type) |
protected List<Object> |
getIds(Class<?> targetType,
Predicate condition) |
com.mysema.commons.lang.CloseableIterator<K> |
iterate()
Get the projection as a typed closeable Iterator
|
com.mysema.commons.lang.CloseableIterator<K> |
iterate(Path<?>... paths) |
<T> JoinBuilder<K,T> |
join(CollectionPathBase<?,T,?> ref,
Path<T> target)
Define a join
|
<T> JoinBuilder<K,T> |
join(Path<T> ref,
Path<T> target)
Define a join
|
MongodbQuery<K> |
limit(long limit)
Set the limit / max results for the query results
|
List<K> |
list()
Get the projection as a typed List
|
List<K> |
list(Path<?>... paths) |
SearchResults<K> |
listResults()
Get the projection in
SearchResults form |
SearchResults<K> |
listResults(Path<?>... paths) |
boolean |
notExists() |
MongodbQuery<K> |
offset(long offset)
Set the offset for the query results
|
MongodbQuery<K> |
orderBy(OrderSpecifier<?>... o)
Add order expressions
|
MongodbQuery<K> |
orderBy(OrderSpecifier<?> o) |
MongodbQuery<K> |
restrict(QueryModifiers modifiers)
Set both limit and offset of the query results
|
<T> MongodbQuery<K> |
set(ParamExpression<T> param,
T value)
Set the given parameter to the given value
|
void |
setReadPreference(com.mongodb.ReadPreference readPreference) |
K |
singleResult()
Get the projection as a single result or null if no result is found
|
K |
singleResult(Path<?>... paths) |
String |
toString() |
K |
uniqueResult()
Get the projection as a unique result or null if no result is found
|
K |
uniqueResult(Path<?>... paths) |
MongodbQuery<K> |
where(Predicate... e)
Adds the given filter conditions
|
MongodbQuery<K> |
where(Predicate e) |
public MongodbQuery(com.mongodb.DBCollection collection,
com.google.common.base.Function<com.mongodb.DBObject,K> transformer,
MongodbSerializer serializer)
collection - transformer - serializer - public <T> JoinBuilder<K,T> join(Path<T> ref, Path<T> target)
ref - target - public <T> JoinBuilder<K,T> join(CollectionPathBase<?,T,?> ref, Path<T> target)
ref - target - public <T> AnyEmbeddedBuilder<K> anyEmbedded(Path<? extends Collection<T>> collection, Path<T> target)
collection - target - protected abstract com.mongodb.DBCollection getCollection(Class<?> type)
public boolean exists()
exists in interface SimpleProjectable<K>@Nullable protected Predicate createFilter(QueryMetadata metadata)
@Nullable protected Predicate createJoinFilter(QueryMetadata metadata)
public boolean notExists()
notExists in interface SimpleProjectable<K>public MongodbQuery<K> distinct()
SimpleQuerydistinct in interface SimpleQuery<MongodbQuery<K>>public MongodbQuery<K> where(Predicate e)
public MongodbQuery<K> where(Predicate... e)
FilteredClauseSkips null arguments
where in interface FilteredClause<MongodbQuery<K>>e - filter conditions to be addedpublic MongodbQuery<K> limit(long limit)
SimpleQuerylimit in interface SimpleQuery<MongodbQuery<K>>public MongodbQuery<K> offset(long offset)
SimpleQueryoffset in interface SimpleQuery<MongodbQuery<K>>public MongodbQuery<K> restrict(QueryModifiers modifiers)
SimpleQueryrestrict in interface SimpleQuery<MongodbQuery<K>>public MongodbQuery<K> orderBy(OrderSpecifier<?> o)
public MongodbQuery<K> orderBy(OrderSpecifier<?>... o)
SimpleQueryorderBy in interface SimpleQuery<MongodbQuery<K>>public <T> MongodbQuery<K> set(ParamExpression<T> param, T value)
SimpleQueryset in interface SimpleQuery<MongodbQuery<K>>public com.mysema.commons.lang.CloseableIterator<K> iterate()
SimpleProjectableiterate in interface SimpleProjectable<K>public List<K> list()
SimpleProjectablelist in interface SimpleProjectable<K>protected com.mongodb.DBCursor createCursor()
protected com.mongodb.DBCursor createCursor(com.mongodb.DBCollection collection,
@Nullable
Predicate where,
List<Expression<?>> projection,
QueryModifiers modifiers,
List<OrderSpecifier<?>> orderBy)
public K singleResult()
SimpleProjectablefor multiple results only the first one is returned
singleResult in interface SimpleProjectable<K>public K uniqueResult()
SimpleProjectableuniqueResult in interface SimpleProjectable<K>public SearchResults<K> listResults(Path<?>... paths)
public SearchResults<K> listResults()
SimpleProjectableSearchResults formlistResults in interface SimpleProjectable<K>public long count()
SimpleProjectablecount in interface SimpleProjectable<K>public void setReadPreference(com.mongodb.ReadPreference readPreference)
Copyright © 2007–2014 Mysema Ltd. All rights reserved.