Example usage for com.mongodb.async.client MongoCollection count

List of usage examples for com.mongodb.async.client MongoCollection count

Introduction

In this page you can find the example usage for com.mongodb.async.client MongoCollection count.

Prototype

@Deprecated
void count(ClientSession clientSession, SingleResultCallback<Long> callback);

Source Link

Document

Counts the number of documents in the collection.

Usage

From source file:io.vertx.ext.mongo.impl.MongoClientImpl.java

License:Open Source License

@Override
public io.vertx.ext.mongo.MongoClient count(String collection, JsonObject query,
        Handler<AsyncResult<Long>> resultHandler) {
    requireNonNull(collection, "collection cannot be null");
    requireNonNull(query, "query cannot be null");
    requireNonNull(resultHandler, "resultHandler cannot be null");

    Bson bquery = wrap(encodeKeyWhenUseObjectId(query));
    MongoCollection<JsonObject> coll = getCollection(collection);
    coll.count(bquery, wrapCallback(resultHandler));
    return this;
}