public class Query extends Object
| Constructor and Description |
|---|
Query() |
Query(CriteriaDefinition criteriaDefinition)
Creates a new
Query using the given CriteriaDefinition. |
| Modifier and Type | Method and Description |
|---|---|
Query |
addCriteria(CriteriaDefinition criteriaDefinition)
Adds the given
CriteriaDefinition to the current Query. |
Query |
comment(String comment) |
boolean |
equals(Object obj) |
Query |
exhaust() |
Field |
fields() |
protected List<CriteriaDefinition> |
getCriteria() |
com.mongodb.DBObject |
getFieldsObject() |
String |
getHint() |
int |
getLimit()
Get the maximum number of documents to be return.
|
Meta |
getMeta() |
com.mongodb.DBObject |
getQueryObject() |
Set<Class<?>> |
getRestrictedTypes() |
int |
getSkip()
Get the number of documents to skip.
|
com.mongodb.DBObject |
getSortObject() |
int |
hashCode() |
static boolean |
isRestrictedTypeKey(String key)
Deprecated.
don't call this method as the restricted type handling will undergo some significant changes going
forward.
|
Query |
limit(int limit)
Limit the number of returned documents to
limit. |
Query |
maxScan(long maxScan) |
Query |
maxTime(long timeout,
TimeUnit timeUnit) |
Query |
maxTimeMsec(long maxTimeMsec) |
Query |
noCursorTimeout() |
Query |
partialResults() |
static Query |
query(CriteriaDefinition criteriaDefinition)
Static factory method to create a
Query using the provided CriteriaDefinition. |
protected boolean |
querySettingsEquals(Query that)
Tests whether the settings of the given
Query are equal to this query. |
Query |
restrict(Class<?> type,
Class<?>... additionalTypes)
Restricts the query to only return documents instances that are exactly of the given types.
|
void |
setMeta(Meta meta) |
Query |
skip(int skip)
Set number of documents to skip before returning results.
|
Query |
slaveOk() |
String |
toString() |
Query |
useSnapshot() |
Query |
with(Pageable pageable)
Sets the given pagination information on the
Query instance. |
Query |
with(Sort sort)
|
Query |
withHint(String name)
Configures the query to use the given hint when being executed.
|
public Query()
public Query(CriteriaDefinition criteriaDefinition)
Query using the given CriteriaDefinition.criteriaDefinition - must not be null.public static Query query(CriteriaDefinition criteriaDefinition)
Query using the provided CriteriaDefinition.criteriaDefinition - must not be null.public Query addCriteria(CriteriaDefinition criteriaDefinition)
CriteriaDefinition to the current Query.criteriaDefinition - must not be null.public Field fields()
public Query skip(int skip)
skip - public Query limit(int limit)
limit.limit - public Query withHint(String name)
name - must not be null or empty.public Query with(Pageable pageable)
Query instance. Will transparently set skip and
limit as well as applying the Sort instance defined with the Pageable.pageable - public Query restrict(Class<?> type, Class<?>... additionalTypes)
type - may not be nulladditionalTypes - may not be nullpublic com.mongodb.DBObject getQueryObject()
public com.mongodb.DBObject getFieldsObject()
public com.mongodb.DBObject getSortObject()
public int getSkip()
public int getLimit()
public String getHint()
public Query maxTimeMsec(long maxTimeMsec)
maxTimeMsec - Meta.setMaxTimeMsec(long)public Query maxTime(long timeout, TimeUnit timeUnit)
timeout - timeUnit - Meta.setMaxTime(long, TimeUnit)public Query maxScan(long maxScan)
maxScan - Meta.setMaxScan(long)public Query comment(String comment)
comment - Meta.setComment(String)public Query useSnapshot()
Meta.setSnapshot(boolean)public Query noCursorTimeout()
Meta.CursorOption.NO_TIMEOUTpublic Query exhaust()
Meta.CursorOption.EXHAUSTpublic Query slaveOk()
Meta.CursorOption.SLAVE_OKpublic Query partialResults()
Meta.CursorOption.PARTIALpublic Meta getMeta()
public void setMeta(Meta meta)
meta - must not be null.protected List<CriteriaDefinition> getCriteria()
protected boolean querySettingsEquals(Query that)
Query are equal to this query.that - @Deprecated public static boolean isRestrictedTypeKey(String key)
key - Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.