Class BasicQuery
java.lang.Object
org.springframework.data.mongodb.core.query.Query
org.springframework.data.mongodb.core.query.BasicQuery
- All Implemented Interfaces:
ReadConcernAware, ReadPreferenceAware
-
Constructor Summary
ConstructorsConstructorDescriptionBasicQuery(@Nullable String query) Create a newBasicQuerygiven a JSONquery.BasicQuery(@Nullable String query, @Nullable String fields) BasicQuery(Document queryObject) Create a newBasicQuerygiven a queryDocument.BasicQuery(Document queryObject, Document fieldsObject) BasicQuery(Query query) Create a BasicQuery given aQuery. -
Method Summary
Modifier and TypeMethodDescriptionaddCriteria(CriteriaDefinition criteria) Adds the givenCriteriaDefinitionto the currentQuery.booleaninthashCode()booleanisSorted()Returns true if theQueryhas a sort parameter.voidsetFieldsObject(Document fieldsObject) Set the fields (projection)Document.voidsetSortObject(Document sortObject) Set the sortDocument.Methods inherited from class Query
allowDiskUse, allowSecondaryReads, collation, comment, cursorBatchSize, diskUse, exhaust, fields, getCollation, getCriteria, getHint, getKeyset, getLimit, getMeta, getReadConcern, getReadPreference, getRestrictedTypes, getSkip, hasKeyset, hasReadConcern, hasReadPreference, isLimited, isRestrictedTypeKey, limit, limit, maxTime, maxTimeMsec, noCursorTimeout, of, partialResults, query, querySettingsEquals, restrict, setMeta, skip, toString, with, with, with, with, with, withHint, withHint, withReadConcern, withReadPreference
-
Constructor Details
-
BasicQuery
Create a newBasicQuerygiven a JSONquery.- Parameters:
query- may be null.
-
BasicQuery
Create a newBasicQuerygiven a queryDocument.- Parameters:
queryObject- must not be null.
-
BasicQuery
- Parameters:
query- may be null.fields- may be null.
-
BasicQuery
- Parameters:
queryObject- must not be null.fieldsObject- must not be null.- Throws:
IllegalArgumentException- whenqueryObjectorfieldsObjectis null.
-
BasicQuery
-
-
Method Details
-
addCriteria
Description copied from class:QueryAdds the givenCriteriaDefinitionto the currentQuery.- Overrides:
addCriteriain classQuery- Parameters:
criteria- must not be null.- Returns:
- this.
-
getQueryObject
- Overrides:
getQueryObjectin classQuery- Returns:
- the query
Document.
-
getFieldsObject
- Overrides:
getFieldsObjectin classQuery- Returns:
- the field
Document.
-
getSortObject
- Overrides:
getSortObjectin classQuery- Returns:
- the sort
Document.
-
setSortObject
Set the sortDocument.- Parameters:
sortObject- must not be null.- Throws:
IllegalArgumentException- whensortObjectis null.
-
isSorted
-
setFieldsObject
Set the fields (projection)Document.- Parameters:
fieldsObject- must not be null.- Throws:
IllegalArgumentException- whenfieldsObjectis null.- Since:
- 1.6
-
equals
-
hashCode
-