org.springframework.data.mongodb.core.MongoTemplate.exists()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(145)

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

MongoTemplate.exists介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
public boolean exists(Query query, String collectionName) {
  return exists(query, null, collectionName);
}

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
public boolean exists() {
  return template.exists(query, domainType, getCollectionName());
}

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
public boolean exists(Query query, Class<?> entityClass) {
  return exists(query, entityClass, operations.determineCollectionName(entityClass));
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

@Override
public boolean exists(Query query, String collectionName) {
  return exists(query, null, collectionName);
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

@Override
public boolean exists(Query query, Class<?> entityClass) {
  return exists(query, entityClass, operations.determineCollectionName(entityClass));
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

@Override
public boolean exists() {
  return template.exists(query, domainType, getCollectionName());
}

代码示例来源:origin: spring-projects/spring-integration

private void addMessageDocument(MessageWrapper document) {
  UUID messageId = (UUID) document.headers.get(MessageHeaders.ID);
  Assert.notNull(messageId, "ID header must not be null");
  Query query = whereMessageIdIsAndGroupIdIs(messageId, document.get_GroupId());
  if (!this.template.exists(query, MessageWrapper.class, this.collectionName)) {
    if (document.get_Group_timestamp() == 0) {
      document.set_Group_timestamp(System.currentTimeMillis());
    }
    document.set_message_timestamp(System.currentTimeMillis());
    this.template.insert(document, this.collectionName);
  }
}

代码示例来源:origin: naturalprogrammer/spring-lemon

@Override
  public boolean isValid(String email, ConstraintValidatorContext context) {
    
    log.debug("Validating whether email is unique: " + email);
    return !mongoTemplate.exists(query(where("email").is(email)), userClass);
  }
}

代码示例来源:origin: org.springframework.integration/spring-integration-mongodb

private void addMessageDocument(MessageWrapper document) {
  UUID messageId = (UUID) document.headers.get(MessageHeaders.ID);
  Assert.notNull(messageId, "ID header must not be null");
  Query query = whereMessageIdIsAndGroupIdIs(messageId, document.get_GroupId());
  if (!this.template.exists(query, MessageWrapper.class, this.collectionName)) {
    if (document.get_Group_timestamp() == 0) {
      document.set_Group_timestamp(System.currentTimeMillis());
    }
    document.set_message_timestamp(System.currentTimeMillis());
    this.template.insert(document, this.collectionName);
  }
}

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

@Override
public boolean isAssignedToProject(String project, String login) {
  return mongoTemplate.exists(
      Query.query(Criteria.where("name").is(project.toLowerCase())).addCriteria(userExists(login)), Project.class);
}

相关文章