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(org.bson.Document queryObject) Create a newBasicQuerygiven a queryDocument.BasicQuery(org.bson.Document queryObject, org.bson.Document fieldsObject) BasicQuery(Query query) Create a BasicQuery given aQuery. -
Method Summary
Modifier and TypeMethodDescriptionaddCriteria(CriteriaDefinition criteria) Adds the givenCriteriaDefinitionto the currentQuery.booleanorg.bson.Documentorg.bson.Documentorg.bson.DocumentinthashCode()booleanisSorted()Returns true if theQueryhas a sort parameter.voidsetFieldsObject(org.bson.Document fieldsObject) Set the fields (projection)Document.voidsetSortObject(org.bson.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
public BasicQuery(org.bson.Document queryObject) Create a newBasicQuerygiven a queryDocument.- Parameters:
queryObject- must not be null.
-
BasicQuery
- Parameters:
query- may be null.fields- may be null.
-
BasicQuery
public BasicQuery(org.bson.Document queryObject, org.bson.Document fieldsObject) - 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
public org.bson.Document getQueryObject()- Overrides:
getQueryObjectin classQuery- Returns:
- the query
Document.
-
getFieldsObject
public org.bson.Document getFieldsObject()- Overrides:
getFieldsObjectin classQuery- Returns:
- the field
Document.
-
getSortObject
public org.bson.Document getSortObject()- Overrides:
getSortObjectin classQuery- Returns:
- the sort
Document.
-
setSortObject
public void setSortObject(org.bson.Document sortObject) Set the sortDocument.- Parameters:
sortObject- must not be null.- Throws:
IllegalArgumentException- whensortObjectis null.
-
isSorted
-
setFieldsObject
public void setFieldsObject(org.bson.Document fieldsObject) Set the fields (projection)Document.- Parameters:
fieldsObject- must not be null.- Throws:
IllegalArgumentException- whenfieldsObjectis null.- Since:
- 1.6
-
equals
-
hashCode
-