本文整理了Java中org.springframework.data.mongodb.core.query.Criteria.all()
方法的一些代码示例,展示了Criteria.all()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Criteria.all()
方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.query.Criteria
类名称:Criteria
方法名:all
[英]Creates a criterion using the $all operator.
[中]使用$all运算符创建条件。
代码示例来源:origin: spring-projects/spring-data-mongodb
/**
* Creates a criterion using the {@literal $all} operator.
*
* @param o
* @return
* @see <a href="https://docs.mongodb.com/manual/reference/operator/query/all/">MongoDB Query operator: $all</a>
*/
public Criteria all(Object... o) {
return all(Arrays.asList(o));
}
代码示例来源:origin: org.springframework.data/spring-data-mongodb
/**
* Creates a criterion using the {@literal $all} operator.
*
* @param o
* @return
* @see <a href="https://docs.mongodb.com/manual/reference/operator/query/all/">MongoDB Query operator: $all</a>
*/
public Criteria all(Object... o) {
return all(Arrays.asList(o));
}
代码示例来源:origin: pl.edu.icm.polindex/polindex-tools
private static Criteria hasTagsCriterion(List<? extends Tag> tags, boolean matchAll) {
Criteria result;
if (CollectionUtils.isEmpty(tags)) {
result = null;
} else if (tags.size() == 1) {
Tag tag = tags.iterator().next();
result = hasTagCriterion(tag);
} else {
List<String> tagsAsStrings = Lists.newArrayList();
for (Tag tag : tags) {
tagsAsStrings.add(tag.getTag());
}
result = Criteria.where(F_TAGS);
if (matchAll) {
result = result.all(tagsAsStrings);
} else {
result = result.in(tagsAsStrings);
}
}
return result;
}
代码示例来源:origin: com.bq.oss.lib/token
@Override
public void deleteByTags(String... tags) {
if (ArrayUtils.isNotEmpty(tags)) {
Query query = Query.query(Criteria.where(TAGS).all((Object[]) tags));
mongoOperations.remove(query, OneTimeAccessToken.class);
}
}
}
代码示例来源:origin: io.corbel.lib/token
@Override
public void deleteByTags(String... tags) {
if (ArrayUtils.isNotEmpty(tags)) {
Query query = Query.query(Criteria.where(TAGS).all((Object[]) tags));
mongoOperations.remove(query, OneTimeAccessToken.class);
}
}
}
代码示例来源:origin: com.bq.corbel.lib/token
@Override
public void deleteByTags(String... tags) {
if (ArrayUtils.isNotEmpty(tags)) {
Query query = Query.query(Criteria.where(TAGS).all((Object[]) tags));
mongoOperations.remove(query, OneTimeAccessToken.class);
}
}
}
代码示例来源:origin: com.epam.reportportal/commons-dao
@Override
public void addCondition(Criteria criteria, FilterCondition filter, CriteriaHolder criteriaHolder) {
/* Validate only collections */
this.validate(criteriaHolder, filter.getValue(), filter.isNegative(), INCORRECT_FILTER_PARAMETERS);
criteria.all((Object[]) this.castValue(criteriaHolder, filter.getValue(), INCORRECT_FILTER_PARAMETERS));
}
代码示例来源:origin: com.bq.oss.lib/queries-mongo
private Criteria criteria(QueryOperator operator, String field, QueryLiteral<?> value) {
Criteria criteria = new Criteria(field);
switch (operator) {
case $ALL:
return criteria.all(((ListQueryLiteral) value).getLiterals());
case $EQ:
return criteria.is(value.getLiteral());
case $GT:
return criteria.gt(value.getLiteral());
case $GTE:
return criteria.gte(value.getLiteral());
case $IN:
return criteria.in(((ListQueryLiteral) value).getLiterals());
case $NIN:
return criteria.nin(((ListQueryLiteral) value).getLiterals());
case $LT:
return criteria.lt(value.getLiteral());
case $LTE:
return criteria.lte(value.getLiteral());
case $NE:
return criteria.ne(value.getLiteral());
case $LIKE:
return criteria.regex((String) value.getLiteral(), "i"); // i means case insensitive
case $ELEM_MATCH:
return criteria.elemMatch(getCriteriaFromResourceQuery((ResourceQuery) value.getLiteral()));
case $EXISTS:
return criteria.exists((Boolean) value.getLiteral());
}
return criteria;
}
内容来源于网络,如有侵权,请联系作者删除!