Class MongoQueryCreator
java.lang.Object
org.springframework.data.repository.query.parser.AbstractQueryCreator<Query,Criteria>
org.springframework.data.mongodb.repository.query.MongoQueryCreator
Custom query creator to create Mongo criterias.
- Author:
- Oliver Gierke, Thomas Darimont, Christoph Strobl, Edward Prentice, Junhyeong Choi
-
Constructor Summary
ConstructorsConstructorDescriptionMongoQueryCreator(PartTree tree, MongoParameterAccessor accessor, MappingContext<?, MongoPersistentProperty> context) Creates a newMongoQueryCreatorfrom the givenPartTree,ConvertingParameterAccessorandMappingContext.MongoQueryCreator(PartTree tree, MongoParameterAccessor accessor, MappingContext<?, MongoPersistentProperty> context, boolean isGeoNearQuery, boolean isSearchQuery) Creates a newMongoQueryCreatorfrom the givenPartTree,ConvertingParameterAccessorandMappingContext. -
Method Summary
Modifier and TypeMethodDescriptionprotected Criteriaprotected Queryprotected Criteriaprotected CriteriacreateContainingCriteria(Part part, MongoPersistentProperty property, Criteria criteria, Object parameter) If the target property of the comparison is of type String, then the operator checks for match using regular expression.protected Criteriaempty(MongoPersistentProperty property, Criteria criteria) Modifies a criterion for thePart.Type.IS_EMPTYandPart.Type.IS_NOT_EMPTYkeywords.protected Criteriaprotected Criteriaprotected Criteriaprotected Criteriaprotected CriteriaMethods inherited from class AbstractQueryCreator
createQuery, createQuery
-
Constructor Details
-
MongoQueryCreator
public MongoQueryCreator(PartTree tree, MongoParameterAccessor accessor, MappingContext<?, MongoPersistentProperty> context) Creates a newMongoQueryCreatorfrom the givenPartTree,ConvertingParameterAccessorandMappingContext.- Parameters:
tree-accessor-context-
-
MongoQueryCreator
public MongoQueryCreator(PartTree tree, MongoParameterAccessor accessor, MappingContext<?, MongoPersistentProperty> context, boolean isGeoNearQuery, boolean isSearchQuery) Creates a newMongoQueryCreatorfrom the givenPartTree,ConvertingParameterAccessorandMappingContext.- Parameters:
tree-accessor-context-isGeoNearQuery-isSearchQuery-
-
-
Method Details
-
create
-
and
-
or
-
complete
-
in
-
nin
-
regex
-
exists
-
empty
Modifies a criterion for thePart.Type.IS_EMPTYandPart.Type.IS_NOT_EMPTYkeywords. Make sure to applynegationfirst forPart.Type.IS_NOT_EMPTY. ForCollectionproperties, checks if the collection size is 0. ForStringproperties, checks if the value equals an empty string and forMapand other types, checks if the value equals an empty document.- Parameters:
property- the targeted property within the domain model.criteria- the criteria to modify.- Returns:
- the criteria with empty semantics applied.
- Since:
- 5.1
-
createContainingCriteria
protected Criteria createContainingCriteria(Part part, MongoPersistentProperty property, Criteria criteria, Object parameter) If the target property of the comparison is of type String, then the operator checks for match using regular expression. If the target property of the comparison is aCollectionthen the operator evaluates to true if it finds an exact match within any member of theCollection.- Parameters:
part-property-criteria-parameter-- Returns:
-