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

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

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

MongoTemplate.dropCollection介绍

暂无

代码示例

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

@Override
public void removeAll(String collectionName) {
 LOG.debug("Remove all documents from [{}] collection.", collectionName);
 mongoTemplate.dropCollection(collectionName);
}

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

public static MongoDbFactory prepareMongoFactory(String... additionalCollectionToDrop) throws Exception{
    MongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(new MongoClient(), "test");
    MongoTemplate template = new MongoTemplate(mongoDbFactory);
    template.dropCollection("messages");
    template.dropCollection("data");
    for (String additionalCollection : additionalCollectionToDrop) {
      template.dropCollection(additionalCollection);
    }
    return mongoDbFactory;
  }
}

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

public <T> void dropCollection(Class<T> entityClass) {
  dropCollection(operations.determineCollectionName(entityClass));
}

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

public void removeAll() {
 LOG.debug("Remove all documents from [{}] collection.", getCollectionName());
 mongoTemplate.dropCollection(getDocumentClass());
}

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

public <T> void dropCollection(Class<T> entityClass) {
  dropCollection(operations.determineCollectionName(entityClass));
}

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

protected void cleanupCollections(MongoDbFactory mongoDbFactory, String... additionalCollectionsToDrop) {
  MongoTemplate template = new MongoTemplate(mongoDbFactory);
  template.dropCollection("messages");
  template.dropCollection("configurableStoreMessages");
  template.dropCollection("data");
  for (String additionalCollection : additionalCollectionsToDrop) {
    template.dropCollection(additionalCollection);
  }
}

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

@After
public void cleanUp() throws Exception {
  MongoDbFactory mongoDbFactory = this.prepareMongoFactory();
  MongoTemplate mongoTemplate = new MongoTemplate(mongoDbFactory);
  mongoTemplate.dropCollection(COLLECTION_NAME);
}

代码示例来源:origin: com.sangupta/jerry-services

/**
 * Drop the given collection.
 * 
 */
@Override
public void deleteAllEntities() {
  this.mongoTemplate.dropCollection(this.entityClass);
}

代码示例来源:origin: org.springframework.xd/spring-xd-test-fixtures

/**
 * The drops the collection.  
 * @param collectionName the name of the database to drop.
 */
public void dropCollection(String collectionName) {
  mongoTemplate.dropCollection(collectionName);
}

代码示例来源:origin: at.researchstudio.sat/won-bot

@Override
public void dropCollection(String collectionName) {
  template.dropCollection(collectionName);
}

代码示例来源:origin: pl.edu.icm.synat/synat-core-services-impl

@Override
public void dropResources() {
  mongoTemplate.dropCollection(collectionName);
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-impl

@Override
public void removeAllCriteria() {
  mongoTemplate.dropCollection(mongoCollectionName);
}

代码示例来源:origin: com.sangupta/jerry

/**
 * Drop the given collection.
 * 
 */
@Override
public void deleteAllEntities() {
  this.mongoTemplate.dropCollection(this.entityClass);
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-impl

@Override
public void dropResources() {
  mongoTemplate.dropCollection(mongoCollectionName);
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-impl

@Override
public void removeAllNotifications() {
  mongoTemplate.dropCollection(mongoCollectionName);
}

代码示例来源:origin: 3zamn/kingMicro

@Override
public void dropPersonCollection(String collectionName) {
  if (StringUtils.isEmpty(collectionName)) {
    collectionName = clz.getSimpleName();
  }
  
  if (mongoTemplate.collectionExists(collectionName)) {
    mongoTemplate.dropCollection(collectionName);
  }
};

相关文章