public class SpringDataMongodbQuery<T>
extends com.querydsl.mongodb.document.AbstractMongodbQuery<Q>
implements com.querydsl.core.Fetchable<T>
Fetchable
Query
implementation.Constructor and Description |
---|
SpringDataMongodbQuery(MongoOperations operations,
Class<? extends T> type)
Creates a new
SpringDataMongodbQuery . |
SpringDataMongodbQuery(MongoOperations operations,
Class<? extends T> type,
String collectionName)
Creates a new
SpringDataMongodbQuery to query the given collection. |
Modifier and Type | Method and Description |
---|---|
org.bson.Document |
asDocument()
Get the where definition as a Document instance
|
protected Query |
createQuery() |
protected Query |
createQuery(com.querydsl.core.types.Predicate filter,
com.querydsl.core.types.Expression<?> projection,
com.querydsl.core.QueryModifiers modifiers,
List<com.querydsl.core.types.OrderSpecifier<?>> orderBy) |
protected org.bson.Document |
createSort(List<com.querydsl.core.types.OrderSpecifier<?>> orderSpecifiers)
Compute the sort
Document from the given list of order specifiers . |
List<T> |
fetch() |
long |
fetchCount() |
T |
fetchFirst() |
T |
fetchOne() |
com.querydsl.core.QueryResults<T> |
fetchResults() |
protected List<Object> |
getIds(Class<?> targetType,
com.querydsl.core.types.Predicate condition)
Fetch the list of ids matching a given condition.
|
com.mysema.commons.lang.CloseableIterator<T> |
iterate() |
String |
toJson()
Obtain the Mongo Shell json query representation.
|
String |
toJson(org.bson.json.JsonWriterSettings settings)
Obtain the json query representation applying given
settings . |
String |
toString()
Returns the Mongo Shell representation of the query.
|
anyEmbedded, createFilter, createJoinFilter, createProjection, createQuery, distinct, join, join, limit, offset, orderBy, orderBy, restrict, set, setReadPreference, where, where
public SpringDataMongodbQuery(MongoOperations operations, Class<? extends T> type)
SpringDataMongodbQuery
.operations
- must not be null.type
- must not be null.public SpringDataMongodbQuery(MongoOperations operations, Class<? extends T> type, String collectionName)
SpringDataMongodbQuery
to query the given collection.operations
- must not be null.type
- must not be null.collectionName
- must not be null or empty.public com.mysema.commons.lang.CloseableIterator<T> iterate()
iterate
in interface com.querydsl.core.Fetchable<T>
public T fetchFirst()
fetchFirst
in interface com.querydsl.core.Fetchable<T>
public com.querydsl.core.QueryResults<T> fetchResults()
fetchResults
in interface com.querydsl.core.Fetchable<T>
public long fetchCount()
fetchCount
in interface com.querydsl.core.Fetchable<T>
protected Query 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)
protected List<Object> getIds(Class<?> targetType, com.querydsl.core.types.Predicate condition)
getIds
in class com.querydsl.mongodb.document.AbstractMongodbQuery<SpringDataMongodbQuery<T>>
targetType
- must not be null.condition
- must not be null.List
if none found.public String toString()
where(p.lastname.eq("Matthews")).orderBy(p.firstname.asc()).offset(1).limit(5);results in
find({"lastname" : "Matthews"}).sort({"firstname" : 1}).skip(1).limit(5)Note that encoding to
String
may fail when using data types that cannot be encoded or DBRef's without an
identifier.toString
in class com.querydsl.mongodb.document.AbstractMongodbQuery<Q extends org.springframework.data.mongodb.repository.support.SpringDataMongodbQuerySupport<Q>>
public org.bson.Document asDocument()
asDocument
in class com.querydsl.mongodb.document.AbstractMongodbQuery<Q extends org.springframework.data.mongodb.repository.support.SpringDataMongodbQuerySupport<Q>>
public String toJson()
public String toJson(org.bson.json.JsonWriterSettings settings)
settings
.settings
- must not be null.protected org.bson.Document createSort(List<com.querydsl.core.types.OrderSpecifier<?>> orderSpecifiers)
Document
from the given list of order specifiers
.orderSpecifiers
- can be null.Document
if predicate is null.MongodbDocumentSerializer.toSort(List)
Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.