本文整理了Java中io.vertx.ext.mongo.MongoClient.dropCollection()
方法的一些代码示例,展示了MongoClient.dropCollection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MongoClient.dropCollection()
方法的具体详情如下:
包路径:io.vertx.ext.mongo.MongoClient
类名称:MongoClient
方法名:dropCollection
暂无
代码示例来源:origin: vert-x3/vertx-examples
private void loadData(MongoClient db) {
db.dropCollection("users", drop -> {
if (drop.failed()) {
throw new RuntimeException(drop.cause());
}
List<JsonObject> users = new LinkedList<>();
users.add(new JsonObject()
.put("username", "pmlopes")
.put("firstName", "Paulo")
.put("lastName", "Lopes")
.put("address", "The Netherlands"));
users.add(new JsonObject()
.put("username", "timfox")
.put("firstName", "Tim")
.put("lastName", "Fox")
.put("address", "The Moon"));
for (JsonObject user : users) {
db.insert("users", user, res -> {
System.out.println("inserted " + user.encode());
});
}
});
}
}
代码示例来源:origin: vert-x3/vertx-examples
private void loadData(MongoClient db) {
db.dropCollection("albums", drop -> {
if (drop.failed()) {
throw new RuntimeException(drop.cause());
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Drop a collection
* @param collection the collection
* @param resultHandler will be called when complete
* @return
*/
public io.vertx.rxjava.ext.mongo.MongoClient dropCollection(String collection, Handler<AsyncResult<Void>> resultHandler) {
delegate.dropCollection(collection, resultHandler);
return this;
}
代码示例来源:origin: io.vertx/vertx-mongo-service
@Override
public MongoService dropCollection(String collection, Handler<AsyncResult<Void>> resultHandler) {
client.dropCollection(collection, resultHandler);
return this;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Drop a collection
* @param collection the collection
* @param resultHandler will be called when complete
* @return
*/
public io.vertx.rxjava.ext.mongo.MongoClient dropCollection(String collection, Handler<AsyncResult<Void>> resultHandler) {
delegate.dropCollection(collection, resultHandler);
return this;
}
代码示例来源:origin: folio-org/okapi
public void init(boolean reset, Handler<ExtendedAsyncResult<Void>> fut) {
if (!reset) {
fut.handle(new Success<>());
} else {
cli.dropCollection(collection, res -> {
if (res.failed()) {
fut.handle(new Failure<>(INTERNAL, res.cause()));
} else {
fut.handle(new Success<>());
}
});
}
}
代码示例来源:origin: io.vertx/vertx-auth-mongo
/**
* Method drops all collections which are starting with the prefix {@link #TABLE_PREFIX}
*
* @param latch
* the latch to be used
*/
protected void dropCollections(CountDownLatch latch) {
// Drop all the collections in the db
mongoClient.getCollections(onSuccess(list -> {
AtomicInteger collCount = new AtomicInteger();
List<String> toDrop = getOurCollections(list);
int count = toDrop.size();
if (!toDrop.isEmpty()) {
for (String collection : toDrop) {
mongoClient.dropCollection(collection, onSuccess(v -> {
if (collCount.incrementAndGet() == count) {
latch.countDown();
}
}));
}
} else {
latch.countDown();
}
}));
}
内容来源于网络,如有侵权,请联系作者删除!