类 Criteria
- java.lang.Object
-
- org.springframework.data.mongodb.core.query.Criteria
-
-
所有已实现的接口:
- CriteriaDefinition
-
直接已知子类:
- GridFsCriteria
public class Criteria extends java.lang.Object implements CriteriaDefinition
Central class for creating queries. It follows a fluent API style so that you can easily chain together multiple criteria. Static import of the 'Criteria.where' method will improve readability.
-
-
构造器概要
构造器 限定符 构造器和说明 Criteria()protectedCriteria(java.util.List<Criteria> criteriaChain, java.lang.String key)Criteria(java.lang.String key)
-
方法概要
方法 限定符和类型 方法和说明 Criteriaall(java.util.Collection<?> o)Criteriaall(java.lang.Object... o)Creates a criterion using the $all operatorCriteriaand(java.lang.String key)Static factory method to create a Criteria using the provided keyCriteriaandOperator(Criteria... criteria)Creates an 'and' criteria using the $and operator for all of the provided criteriaCriteriaelemMatch(Criteria c)Creates a criterion using the $elemMatch operatorbooleanequals(java.lang.Object obj)Criteriaexists(boolean b)Creates a criterion using the $exists operatorDBObjectgetCriteriaObject()java.lang.StringgetKey()protected DBObjectgetSingleCriteriaObject()Criteriagt(java.lang.Object o)Creates a criterion using the $gt operatorCriteriagte(java.lang.Object o)Creates a criterion using the $gte operatorinthashCode()Criteriain(java.util.Collection<?> c)Creates a criterion using the $in operatorCriteriain(java.lang.Object... o)Creates a criterion using the $in operatorCriteriais(java.lang.Object o)Creates a criterion using equalityCriterialt(java.lang.Object o)Creates a criterion using the $lt operatorCriterialte(java.lang.Object o)Creates a criterion using the $lte operatorCriteriamaxDistance(double maxDistance)Creates a geospatical criterion using a $maxDistance operation, for use with $nearCriteriamod(java.lang.Number value, java.lang.Number remainder)Creates a criterion using the $mod operatorCriteriane(java.lang.Object o)Creates a criterion using the $ne operatorCriterianear(Point point)Creates a geospatial criterion using a $near operationCriterianearSphere(Point point)Creates a geospatial criterion using a $nearSphere operation.Criterianin(java.util.Collection<?> o)Criterianin(java.lang.Object... o)Creates a criterion using the $nin operatorCriterianorOperator(Criteria... criteria)Creates a 'nor' criteria using the $nor operator for all of the provided criteriaCriterianot()Creates a criterion using the $not meta operator which affects the clause directly followingCriteriaorOperator(Criteria... criteria)Creates an 'or' criteria using the $or operator for all of the provided criteriaCriteriaregex(java.util.regex.Pattern pattern)Syntactical sugar foris(Object)making obvious that we create a regex predicate.Criteriaregex(java.lang.String re)Creates a criterion using a $regexCriteriaregex(java.lang.String re, java.lang.String options)Creates a criterion using a $regex and $optionsCriteriasize(int s)Creates a criterion using the $size operatorCriteriatype(int t)Creates a criterion using the $type operatorstatic Criteriawhere(java.lang.String key)Static factory method to create a Criteria using the provided keyCriteriawithin(Shape shape)CriteriawithinSphere(Circle circle)Creates a geospatial criterion using a $within $center operation.
-
-
-
构造器详细资料
-
Criteria
public Criteria()
-
Criteria
public Criteria(java.lang.String key)
-
Criteria
protected Criteria(java.util.List<Criteria> criteriaChain, java.lang.String key)
-
-
方法详细资料
-
where
public static Criteria where(java.lang.String key)
Static factory method to create a Criteria using the provided key-
参数:
-
key-
返回:
-
-
and
public Criteria and(java.lang.String key)
Static factory method to create a Criteria using the provided key-
返回:
-
is
public Criteria is(java.lang.Object o)
Creates a criterion using equality-
参数:
-
o-
返回:
-
-
ne
public Criteria ne(java.lang.Object o)
Creates a criterion using the $ne operator-
参数:
-
o-
返回:
-
-
lt
public Criteria lt(java.lang.Object o)
Creates a criterion using the $lt operator-
参数:
-
o-
返回:
-
-
lte
public Criteria lte(java.lang.Object o)
Creates a criterion using the $lte operator-
参数:
-
o-
返回:
-
-
gt
public Criteria gt(java.lang.Object o)
Creates a criterion using the $gt operator-
参数:
-
o-
返回:
-
-
gte
public Criteria gte(java.lang.Object o)
Creates a criterion using the $gte operator-
参数:
-
o-
返回:
-
-
in
public Criteria in(java.lang.Object... o)
Creates a criterion using the $in operator-
参数:
-
o- the values to match against
返回:
-
-
in
public Criteria in(java.util.Collection<?> c)
Creates a criterion using the $in operator-
参数:
-
c- the collection containing the values to match against
返回:
-
-
nin
public Criteria nin(java.lang.Object... o)
Creates a criterion using the $nin operator-
参数:
-
o-
返回:
-
-
nin
public Criteria nin(java.util.Collection<?> o)
-
mod
public Criteria mod(java.lang.Number value, java.lang.Number remainder)
Creates a criterion using the $mod operator-
参数:
-
value- -
remainder-
返回:
-
-
all
public Criteria all(java.lang.Object... o)
Creates a criterion using the $all operator-
参数:
-
o-
返回:
-
-
all
public Criteria all(java.util.Collection<?> o)
-
size
public Criteria size(int s)
Creates a criterion using the $size operator-
参数:
-
s-
返回:
-
-
exists
public Criteria exists(boolean b)
Creates a criterion using the $exists operator-
参数:
-
b-
返回:
-
-
type
public Criteria type(int t)
Creates a criterion using the $type operator-
参数:
-
t-
返回:
-
-
not
public Criteria not()
Creates a criterion using the $not meta operator which affects the clause directly following-
返回:
-
regex
public Criteria regex(java.lang.String re)
Creates a criterion using a $regex-
参数:
-
re-
返回:
-
-
regex
public Criteria regex(java.lang.String re, java.lang.String options)
Creates a criterion using a $regex and $options-
参数:
-
re- -
options-
返回:
-
-
regex
public Criteria regex(java.util.regex.Pattern pattern)
Syntactical sugar foris(Object)making obvious that we create a regex predicate.-
参数:
-
pattern-
返回:
-
-
withinSphere
public Criteria withinSphere(Circle circle)
Creates a geospatial criterion using a $within $center operation. This is only available for Mongo 1.7 and higher.-
参数:
-
circle- must not be null
返回:
-
-
near
public Criteria near(Point point)
Creates a geospatial criterion using a $near operation-
参数:
-
point- must not be null
返回:
-
-
nearSphere
public Criteria nearSphere(Point point)
Creates a geospatial criterion using a $nearSphere operation. This is only available for Mongo 1.7 and higher.-
参数:
-
point- must not be null
返回:
-
-
maxDistance
public Criteria maxDistance(double maxDistance)
Creates a geospatical criterion using a $maxDistance operation, for use with $near-
参数:
-
maxDistance-
返回:
-
-
elemMatch
public Criteria elemMatch(Criteria c)
Creates a criterion using the $elemMatch operator-
参数:
-
c-
返回:
-
-
orOperator
public Criteria orOperator(Criteria... criteria)
Creates an 'or' criteria using the $or operator for all of the provided criteria-
参数:
-
criteria-
-
-
norOperator
public Criteria norOperator(Criteria... criteria)
Creates a 'nor' criteria using the $nor operator for all of the provided criteria-
参数:
-
criteria-
-
-
andOperator
public Criteria andOperator(Criteria... criteria)
Creates an 'and' criteria using the $and operator for all of the provided criteria-
参数:
-
criteria-
-
-
getKey
public java.lang.String getKey()
-
getCriteriaObject
public DBObject getCriteriaObject()
-
指定者:
-
getCriteriaObject在接口中CriteriaDefinition
-
-
getSingleCriteriaObject
protected DBObject getSingleCriteriaObject()
-
equals
public boolean equals(java.lang.Object obj)
-
覆盖:
-
equals在类中java.lang.Object
-
-
hashCode
public int hashCode()
-
覆盖:
-
hashCode在类中java.lang.Object
-
-
-
Criteria是Spring Data MongoDB中用于创建查询的核心类,提供了一种流畅的API来组合多个查询条件。通过静态导入`Criteria.where`方法可以提高代码的可读性。Criteria支持多种比较操作符,如$eq(等于)、$ne(不等于)、$lt(小于)、$lte(小于等于)、$gt(大于)、$gte(大于等于),以及$in、$nin、$mod等。此外,还支持$all、$size、$exists、$type等操作符,以及地理位置相关的查询操作,如$near、$nearSphere等。Criteria类允许使用$elemMatch、$or、$nor和$and操作符来组合复杂查询条件。

177

被折叠的 条评论
为什么被折叠?



