本文整理了Java中io.vertx.ext.mongo.MongoClient.count()
方法的一些代码示例,展示了MongoClient.count()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MongoClient.count()
方法的具体详情如下:
包路径:io.vertx.ext.mongo.MongoClient
类名称:MongoClient
方法名:count
暂无
代码示例来源:origin: io.vertx/vertx-mongo-service
@Override
public MongoService count(String collection, JsonObject query, Handler<AsyncResult<Long>> resultHandler) {
client.count(collection, query, resultHandler);
return this;
}
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Count matching documents in a collection.
* @param collection the collection
* @param query query used to match documents
* @param resultHandler will be provided with the number of matching documents
* @return
*/
public io.vertx.rxjava.ext.mongo.MongoClient count(String collection, JsonObject query, Handler<AsyncResult<Long>> resultHandler) {
delegate.count(collection, query, resultHandler);
return this;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Count matching documents in a collection.
* @param collection the collection
* @param query query used to match documents
* @param resultHandler will be provided with the number of matching documents
* @return
*/
public io.vertx.rxjava.ext.mongo.MongoClient count(String collection, JsonObject query, Handler<AsyncResult<Long>> resultHandler) {
delegate.count(collection, query, resultHandler);
return this;
}
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static io.vertx.ext.mongo.MongoClient count(io.vertx.ext.mongo.MongoClient j_receiver, java.lang.String collection, java.util.Map<String, Object> query, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler) {
io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.count(collection,
query != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(query) : null,
resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>>() {
public void handle(io.vertx.core.AsyncResult<java.lang.Long> ar) {
resultHandler.handle(ar.map(event -> event));
}
} : null));
return j_receiver;
}
public static io.vertx.ext.mongo.MongoClient remove(io.vertx.ext.mongo.MongoClient j_receiver, java.lang.String collection, java.util.Map<String, Object> query, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler) {
代码示例来源:origin: de.braintags/vertx-key-generator
private void initCounterCollection(Handler<AsyncResult<Void>> handler) {
LOGGER.info("Init of sequence collection with " + collectionName);
mongoClient.count(collectionName, referenceQuery, result -> {
if (result.failed()) {
handler.handle(Future.failedFuture(result.cause()));
} else {
long count = result.result();
if (count == 0) {
LOGGER.info("Inserting initial sequence record into collection " + collectionName);
this.mongoClient.insert(collectionName, referenceQuery, insertResult -> {
if (result.failed()) {
handler.handle(Future.failedFuture(insertResult.cause()));
} else {
LOGGER.info(result);
handler.handle(Future.succeededFuture());
}
});
} else {
LOGGER.info("Record exists already");
handler.handle(Future.succeededFuture());
}
}
});
}
代码示例来源:origin: cescoffier/my-vertx-first-app
mongo.count(COLLECTION, new JsonObject(), count -> {
if (count.succeeded()) {
if (count.result() == 0) {
内容来源于网络,如有侵权,请联系作者删除!