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

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

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

MongoTemplate.remove介绍

暂无

代码示例

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

@Override
public DeleteResult remove(Object object) {
  Assert.notNull(object, "Object must not be null!");
  Query query = operations.forEntity(object).getByIdQuery();
  return remove(query, object.getClass());
}

代码示例来源:origin: kaaproject/kaa

/**
  * Remove item by id.
  * @param key is unique key
  */
 public void removeById(K key) {
  LOG.debug("Remove document of collection [{}] by id [{}]", getCollectionName(), key);
  T object = findById(key);
  if (object != null) {
   mongoTemplate.remove(object);
  }
 }
}

代码示例来源:origin: ityouknow/spring-boot-examples

/**
   * 删除对象
   * @param id
   */
  @Override
  public void deleteUserById(Long id) {
    Query query=new Query(Criteria.where("id").is(id));
    mongoTemplate.remove(query,UserEntity.class);
  }
}

代码示例来源:origin: yu199195/hmily

@Override
public Boolean batchRemove(final List<String> ids, final String applicationName) {
  if (CollectionUtils.isEmpty(ids) || StringUtils.isBlank(applicationName)) {
    return Boolean.FALSE;
  }
  final String mongoTableName = RepositoryPathUtils.buildMongoTableName(applicationName);
  ids.forEach(id -> {
    Query query = new Query();
    query.addCriteria(new Criteria("transId").is(id));
    mongoTemplate.remove(query, mongoTableName);
  });
  return Boolean.TRUE;
}

代码示例来源:origin: yu199195/Raincat

@Override
public Boolean batchRemove(final List<String> ids, final String applicationName) {
  if (CollectionUtils.isEmpty(ids) || StringUtils.isBlank(applicationName)) {
    return Boolean.FALSE;
  }
  final String mongoTableName = RepositoryPathUtils.buildMongoTableName(applicationName);
  ids.forEach(id -> {
    Query query = new Query();
    query.addCriteria(new Criteria("transId").is(id));
    mongoTemplate.remove(query, mongoTableName);
  });
  return Boolean.TRUE;
}

代码示例来源:origin: roncoo/spring-boot-demo

public void deleteById(int id) {
  Criteria criteria = Criteria.where("id").in(id);
  Query query = new Query(criteria);
  mongoTemplate.remove(query, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void deleteById(int id) {
  Criteria criteria = Criteria.where("id").in(id);
  Query query = new Query(criteria);
  mongoTemplate.remove(query, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void deleteById(int id) {
  Criteria criteria = Criteria.where("id").in(id);
  Query query = new Query(criteria);
  mongoTemplate.remove(query, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void deleteById(int id) {
  Criteria criteria = Criteria.where("id").in(id);
  Query query = new Query(criteria);
  mongoTemplate.remove(query, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void deleteById(int id) {
  Criteria criteria = Criteria.where("id").in(id);
  Query query = new Query(criteria);
  mongoTemplate.remove(query, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void deleteById(int id) {
  Criteria criteria = Criteria.where("id").in(id);
  Query query = new Query(criteria);
  mongoTemplate.remove(query, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void deleteById(int id) {
  Criteria criteria = Criteria.where("id").in(id);
  Query query = new Query(criteria);
  mongoTemplate.remove(query, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void deleteById(int id) {
  Criteria criteria = Criteria.where("id").in(id);
  Query query = new Query(criteria);
  mongoTemplate.remove(query, RoncooUser.class);
}

代码示例来源:origin: roncoo/spring-boot-demo

public void deleteById(int id) {
  Criteria criteria = Criteria.where("id").in(id);
  Query query = new Query(criteria);
  mongoTemplate.remove(query, RoncooUser.class);
}

代码示例来源:origin: kaaproject/kaa

@Override
public void removeNotificationsByKeyHash(final byte[] keyHash) {
 LOG.debug("Remove unicast notifications by endpoint key hash [{}] ", keyHash);
 mongoTemplate.remove(query(where(EP_ENDPOINT_KEY_HASH).is(keyHash)), getCollectionName());
}

代码示例来源:origin: kaaproject/kaa

@Override
public void removeByKeyHash(byte[] endpointKeyHash) {
 LOG.debug("Remove endpoint profile by endpoint key hash [{}] ", endpointKeyHash);
 mongoTemplate.remove(query(where(EP_ENDPOINT_KEY_HASH)
     .is(endpointKeyHash)),
   getCollectionName());
}

代码示例来源:origin: yu199195/myth

@Override
public int remove(final String transId) {
  Query query = new Query();
  query.addCriteria(new Criteria("transId").is(transId));
  template.remove(query, collectionName);
  return CommonConstant.SUCCESS;
}

代码示例来源:origin: kaaproject/kaa

@Override
public void removeByEndpointKeyHashAndConfigurationVersion(byte[] endpointKeyHash, Integer confSchemaVersion) {
 LOG.debug("Remove endpoint specific configuration by endpoint key hash [{}] ", endpointKeyHash);
 mongoTemplate.remove(
   query(where(EP_SPECIFIC_CONFIGURATION_KEY_HASH).is(endpointKeyHash)
     .and(EP_CONFIGURATION_VERSION).is(confSchemaVersion)), getCollectionName());
}

代码示例来源:origin: yu199195/hmily

@Override
public int remove(final String id) {
  AssertUtils.notNull(id);
  Query query = new Query();
  query.addCriteria(new Criteria("transId").is(id));
  template.remove(query, collectionName);
  return ROWS;
}

代码示例来源:origin: yu199195/Raincat

@Override
public int remove(final String id) {
  Assert.notNull(id);
  Query query = new Query();
  query.addCriteria(new Criteria("transId").is(id));
  template.remove(query, collectionName);
  return ROWS;
}

相关文章