org.springframework.data.mongodb.core.query.Criteria.size()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(166)

本文整理了Java中org.springframework.data.mongodb.core.query.Criteria.size()方法的一些代码示例,展示了Criteria.size()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Criteria.size()方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.query.Criteria
类名称:Criteria
方法名:size

Criteria.size介绍

[英]Creates a criterion using the $size operator.
[中]使用$size运算符创建条件。

代码示例

代码示例来源:origin: pl.edu.icm.polindex/polindex-core

private Criteria proposalsExistsCriterion(Boolean notificationsExists) {
  if(notificationsExists) {
    return Criteria.where(PROPERTY_PROPOSALS).not().size(0);
  }
  return Criteria.where(PROPERTY_PROPOSALS).size(0);
}

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
public void addCondition(Criteria criteria, FilterCondition filter, CriteriaHolder criteriaHolder) {
  /* Validate only numbers */
  this.validate(criteriaHolder, filter.getValue(), filter.isNegative(), INCORRECT_FILTER_PARAMETERS);
  criteria.size(Integer.parseInt(filter.getValue()));
}

代码示例来源:origin: com.epam.reportportal/commons-dao

/**
 * Create {@link org.springframework.data.mongodb.core.query.Query} for loading non shared
 * entities owned by specified user
 *
 * @param owner Widget owner
 * @return Query
 */
public static Query createUnsharedEntityQuery(String owner) {
  return Query.query(Criteria.where("acl.ownerUserId").is(owner)).addCriteria(Criteria.where("acl.entries").size(0));
}

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
public UserFilter findOneLoadACL(String userName, String id, String projectName) {
  Query query = Query.query(where(OWNER).is(userName)).addCriteria(where(ID).is(id))
      .addCriteria(where(PROJECT).is(projectName));
  Query shared = Query.query(where(ID).is(id)).addCriteria(where(ENTRIES).size(1))
      .addCriteria(where(PROJECT).is(projectName));
  query.fields().include(TARGET).include(ACL).include(LINK);
  shared.fields().include(TARGET).include(ACL).include(LINK);
  UserFilter filter = mongoTemplate.findOne(query, UserFilter.class);
  return filter == null ? mongoTemplate.findOne(shared, UserFilter.class) : filter;
}

相关文章