io.vertx.ext.mongo

## Interface MongoClient

-     public interface MongoClient

  A Vert.x service used to interact with MongoDB server instances.

  Some of the operations might change _id field of passed `JsonObject` document.

  Author:
    Tim Fox

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_DB_NAME` The name of the default database
    `static String` | `DEFAULT_POOL_NAME` The name of the default pool

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `ReadStream<JsonObject>` | `aggregate(String collection, JsonArray pipeline)` Run aggregate MongoDB command with default `AggregateOptions`.
    `ReadStream<JsonObject>` | `aggregateWithOptions(String collection, JsonArray pipeline, AggregateOptions options)` Run aggregate MongoDB command.
    `Future<MongoClientBulkWriteResult>` | `bulkWrite(String collection, List<BulkOperation> operations)` Like `bulkWrite(String, List, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `bulkWrite(String collection, List<BulkOperation> operations, Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)` Execute a bulk operation.
    `Future<MongoClientBulkWriteResult>` | `bulkWriteWithOptions(String collection, List<BulkOperation> operations, BulkWriteOptions bulkWriteOptions)` Like `bulkWriteWithOptions(String, List, BulkWriteOptions, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `bulkWriteWithOptions(String collection, List<BulkOperation> operations, BulkWriteOptions bulkWriteOptions, Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)` Execute a bulk operation with the specified write options.
    `Future<Void>` | `close()` Like `close(Handler)` but returns a `Future` of the asynchronous result
    `void` | `close(Handler<AsyncResult<Void>> handler)` Close the client and release its resources
    `Future<Long>` | `count(String collection, JsonObject query)` Like `count(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `count(String collection, JsonObject query, Handler<AsyncResult<Long>> resultHandler)` Count matching documents in a collection.
    `static MongoClient` | `create(Vertx vertx, JsonObject config)` Create a Mongo client which maintains its own data source.
    `Future<Void>` | `createCollection(String collectionName)` Like `createCollection(String, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `createCollection(String collectionName, Handler<AsyncResult<Void>> resultHandler)` Create a new collection
    `Future<MongoGridFsClient>` | `createDefaultGridFsBucketService()` Like `createDefaultGridFsBucketService(Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `createDefaultGridFsBucketService(Handler<AsyncResult<MongoGridFsClient>> resultHandler)` Creates a `MongoGridFsClient` used to interact with Mongo GridFS.
    `Future<MongoGridFsClient>` | `createGridFsBucketService(String bucketName)` Like `createGridFsBucketService(String, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `createGridFsBucketService(String bucketName, Handler<AsyncResult<MongoGridFsClient>> resultHandler)` Creates a `MongoGridFsClient` used to interact with Mongo GridFS.
    `Future<Void>` | `createIndex(String collection, JsonObject key)` Like `createIndex(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `createIndex(String collection, JsonObject key, Handler<AsyncResult<Void>> resultHandler)` Creates an index.
    `Future<Void>` | `createIndexes(String collection, List<IndexModel> indexes)` Like `createIndexes(String, List, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `createIndexes(String collection, List<IndexModel> indexes, Handler<AsyncResult<Void>> resultHandler)` creates an indexes
    `Future<Void>` | `createIndexWithOptions(String collection, JsonObject key, IndexOptions options)` Like `createIndexWithOptions(String, JsonObject, IndexOptions, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `createIndexWithOptions(String collection, JsonObject key, IndexOptions options, Handler<AsyncResult<Void>> resultHandler)` Creates an index.
    `static MongoClient` | `createShared(Vertx vertx, JsonObject config)` Like `createShared(io.vertx.core.Vertx, JsonObject, String)` but with the default data source name
    `static MongoClient` | `createShared(Vertx vertx, JsonObject config, String dataSourceName)` Create a Mongo client which shares its data source with any other Mongo clients created with the same data source name
    `static MongoClient` | `createWithMongoSettings(Vertx vertx, JsonObject config, String dataSourceName, com.mongodb.MongoClientSettings settings)` Constructor targeting the jvm, like standard constructor `createShared(Vertx, JsonObject, String)`, but it accepts default mongoClientSettings to configure mongo
    `Future<JsonArray>` | `distinct(String collection, String fieldName, String resultClassname)` Like `distinct(String, String, String, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `distinct(String collection, String fieldName, String resultClassname, Handler<AsyncResult<JsonArray>> resultHandler)` Gets the distinct values of the specified field name.
    `ReadStream<JsonObject>` | `distinctBatch(String collection, String fieldName, String resultClassname)` Gets the distinct values of the specified field name.
    `ReadStream<JsonObject>` | `distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query)` Gets the distinct values of the specified field name filtered by specified query.
    `ReadStream<JsonObject>` | `distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, int batchSize)` Gets the distinct values of the specified field name filtered by specified query.
    `Future<JsonArray>` | `distinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query)` Like `distinctWithQuery(String, String, String, JsonObject, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `distinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, Handler<AsyncResult<JsonArray>> resultHandler)` Gets the distinct values of the specified field name filtered by specified query.
    `Future<Void>` | `dropCollection(String collection)` Like `dropCollection(String, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `dropCollection(String collection, Handler<AsyncResult<Void>> resultHandler)` Drop a collection
    `Future<Void>` | `dropIndex(String collection, String indexName)` Like `dropIndex(String, String, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `dropIndex(String collection, String indexName, Handler<AsyncResult<Void>> resultHandler)` Drops the index given its name.
    `Future<List<JsonObject>>` | `find(String collection, JsonObject query)` Like `find(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `find(String collection, JsonObject query, Handler<AsyncResult<List<JsonObject>>> resultHandler)` Find matching documents in the specified collection
    `ReadStream<JsonObject>` | `findBatch(String collection, JsonObject query)` Find matching documents in the specified collection.
    `ReadStream<JsonObject>` | `findBatchWithOptions(String collection, JsonObject query, FindOptions options)` Find matching documents in the specified collection, specifying options.
    `Future<JsonObject>` | `findOne(String collection, JsonObject query, JsonObject fields)` Like `findOne(String, JsonObject, JsonObject, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `findOne(String collection, JsonObject query, JsonObject fields, Handler<AsyncResult<JsonObject>> resultHandler)` Find a single matching document in the specified collection
    `Future<JsonObject>` | `findOneAndDelete(String collection, JsonObject query)` Like `findOneAndDelete(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `findOneAndDelete(String collection, JsonObject query, Handler<AsyncResult<JsonObject>> resultHandler)` Find a single matching document in the specified collection and delete it.
    `Future<JsonObject>` | `findOneAndDeleteWithOptions(String collection, JsonObject query, FindOptions findOptions)` Like `findOneAndDeleteWithOptions(String, JsonObject, FindOptions, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `findOneAndDeleteWithOptions(String collection, JsonObject query, FindOptions findOptions, Handler<AsyncResult<JsonObject>> resultHandler)` Find a single matching document in the specified collection and delete it.
    `Future<JsonObject>` | `findOneAndReplace(String collection, JsonObject query, JsonObject replace)` Like `findOneAndReplace(String, JsonObject, JsonObject, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `findOneAndReplace(String collection, JsonObject query, JsonObject replace, Handler<AsyncResult<JsonObject>> resultHandler)` Find a single matching document in the specified collection and replace it.
    `Future<JsonObject>` | `findOneAndReplaceWithOptions(String collection, JsonObject query, JsonObject replace, FindOptions findOptions, UpdateOptions updateOptions)` Like `findOneAndReplaceWithOptions(String, JsonObject, JsonObject, FindOptions, UpdateOptions, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `findOneAndReplaceWithOptions(String collection, JsonObject query, JsonObject replace, FindOptions findOptions, UpdateOptions updateOptions, Handler<AsyncResult<JsonObject>> resultHandler)` Find a single matching document in the specified collection and replace it.
    `Future<JsonObject>` | `findOneAndUpdate(String collection, JsonObject query, JsonObject update)` Like `findOneAndUpdate(String, JsonObject, JsonObject, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `findOneAndUpdate(String collection, JsonObject query, JsonObject update, Handler<AsyncResult<JsonObject>> resultHandler)` Find a single matching document in the specified collection and update it.
    `Future<JsonObject>` | `findOneAndUpdateWithOptions(String collection, JsonObject query, JsonObject update, FindOptions findOptions, UpdateOptions updateOptions)` Like `findOneAndUpdateWithOptions(String, JsonObject, JsonObject, FindOptions, UpdateOptions, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `findOneAndUpdateWithOptions(String collection, JsonObject query, JsonObject update, FindOptions findOptions, UpdateOptions updateOptions, Handler<AsyncResult<JsonObject>> resultHandler)` Find a single matching document in the specified collection and update it.
    `Future<List<JsonObject>>` | `findWithOptions(String collection, JsonObject query, FindOptions options)` Like `findWithOptions(String, JsonObject, FindOptions, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `findWithOptions(String collection, JsonObject query, FindOptions options, Handler<AsyncResult<List<JsonObject>>> resultHandler)` Find matching documents in the specified collection, specifying options
    `Future<List<String>>` | `getCollections()` Like `getCollections(Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `getCollections(Handler<AsyncResult<List<String>>> resultHandler)` Get a list of all collections in the database.
    `Future<String>` | `insert(String collection, JsonObject document)`
    `MongoClient` | `insert(String collection, JsonObject document, Handler<AsyncResult<String>> resultHandler)` Insert a document in the specified collection
    `Future<String>` | `insertWithOptions(String collection, JsonObject document, WriteOption writeOption)`
    `MongoClient` | `insertWithOptions(String collection, JsonObject document, WriteOption writeOption, Handler<AsyncResult<String>> resultHandler)` Insert a document in the specified collection with the specified write option
    `Future<JsonArray>` | `listIndexes(String collection)` Like `listIndexes(String, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `listIndexes(String collection, Handler<AsyncResult<JsonArray>> resultHandler)` Get all the indexes in this collection.
    `Future<MongoClientDeleteResult>` | `removeDocument(String collection, JsonObject query)` Like `removeDocument(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `removeDocument(String collection, JsonObject query, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)` Remove a single matching document from a collection and return the handler with MongoClientDeleteResult result
    `Future<MongoClientDeleteResult>` | `removeDocuments(String collection, JsonObject query)` Like `removeDocuments(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `removeDocuments(String collection, JsonObject query, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)` Remove matching documents from a collection and return the handler with MongoClientDeleteResult result
    `Future<MongoClientDeleteResult>` | `removeDocumentsWithOptions(String collection, JsonObject query, WriteOption writeOption)` Like `removeDocumentsWithOptions(String, JsonObject, WriteOption, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `removeDocumentsWithOptions(String collection, JsonObject query, WriteOption writeOption, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)` Remove matching documents from a collection with the specified write option and return the handler with MongoClientDeleteResult result
    `Future<MongoClientDeleteResult>` | `removeDocumentWithOptions(String collection, JsonObject query, WriteOption writeOption)` Like `removeDocumentWithOptions(String, JsonObject, WriteOption, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `removeDocumentWithOptions(String collection, JsonObject query, WriteOption writeOption, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)` Remove a single matching document from a collection with the specified write option and return the handler with MongoClientDeleteResult result
    `Future<MongoClientUpdateResult>` | `replaceDocuments(String collection, JsonObject query, JsonObject replace)`
    `MongoClient` | `replaceDocuments(String collection, JsonObject query, JsonObject replace, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)` Replace matching documents in the specified collection and return the handler with MongoClientUpdateResult result
    `Future<MongoClientUpdateResult>` | `replaceDocumentsWithOptions(String collection, JsonObject query, JsonObject replace, UpdateOptions options)`
    `MongoClient` | `replaceDocumentsWithOptions(String collection, JsonObject query, JsonObject replace, UpdateOptions options, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)` Replace matching documents in the specified collection, specifying options and return the handler with MongoClientUpdateResult result
    `Future<JsonObject>` | `runCommand(String commandName, JsonObject command)` Like `runCommand(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result
    `MongoClient` | `runCommand(String commandName, JsonObject command, Handler<AsyncResult<JsonObject>> resultHandler)` Run an arbitrary MongoDB command.
    `Future<String>` | `save(String collection, JsonObject document)`
    `MongoClient` | `save(String collection, JsonObject document, Handler<AsyncResult<String>> resultHandler)` Save a document in the specified collection
    `Future<String>` | `saveWithOptions(String collection, JsonObject document, WriteOption writeOption)`
    `MongoClient` | `saveWithOptions(String collection, JsonObject document, WriteOption writeOption, Handler<AsyncResult<String>> resultHandler)` Save a document in the specified collection with the specified write option
    `Future<MongoClientUpdateResult>` | `updateCollection(String collection, JsonObject query, JsonObject update)`
    `MongoClient` | `updateCollection(String collection, JsonObject query, JsonObject update, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)` Update matching documents in the specified collection and return the handler with MongoClientUpdateResult result
    `Future<MongoClientUpdateResult>` | `updateCollectionWithOptions(String collection, JsonObject query, JsonObject update, UpdateOptions options)`
    `MongoClient` | `updateCollectionWithOptions(String collection, JsonObject query, JsonObject update, UpdateOptions options, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)` Update matching documents in the specified collection, specifying options and return the handler with MongoClientUpdateResult result

- - ### Field Detail

    - #### DEFAULT_POOL_NAME

          static final String DEFAULT_POOL_NAME

      The name of the default pool
      See Also:
        Constant Field Values

    - #### DEFAULT_DB_NAME

          static final String DEFAULT_DB_NAME

      The name of the default database
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### create

          static MongoClient create(Vertx vertx,
                                    JsonObject config)

      Create a Mongo client which maintains its own data source.
      Parameters:
        `vertx` - the Vert.x instance
        `config` - the configuration
      Returns:
        the client

    - #### createShared

          static MongoClient createShared(Vertx vertx,
                                          JsonObject config,
                                          String dataSourceName)

      Create a Mongo client which shares its data source with any other Mongo clients created with the same data source name
      Parameters:
        `vertx` - the Vert.x instance
        `config` - the configuration
        `dataSourceName` - the data source name
      Returns:
        the client

    - #### createShared

          static MongoClient createShared(Vertx vertx,
                                          JsonObject config)

      Like `createShared(io.vertx.core.Vertx, JsonObject, String)` but with the default data source name
      Parameters:
        `vertx` - the Vert.x instance
        `config` - the configuration
      Returns:
        the client

    - #### createWithMongoSettings

          static MongoClient createWithMongoSettings(Vertx vertx,
                                                     JsonObject config,
                                                     String dataSourceName,
                                                     com.mongodb.MongoClientSettings settings)

      Constructor targeting the jvm, like standard constructor `createShared(Vertx, JsonObject, String)`, but it accepts default mongoClientSettings to configure mongo
      Parameters:
        `vertx` - the Vert.x instance
        `config` - the configuration use only to provide objectId and database name
        `dataSourceName` - the data source name
        `settings` - the native java mongo settings
      Returns:
        the client

    - #### save

          MongoClient save(String collection,
                           JsonObject document,
                           Handler<AsyncResult<String>> resultHandler)

      Save a document in the specified collection

      This operation might change _id field of document parameter

      Parameters:
        `collection` - the collection
        `document` - the document
        `resultHandler` - result handler will be provided with the id if document didn't already have one

    - #### save

          Future<String> save(String collection,
                              JsonObject document)

    - #### saveWithOptions

          MongoClient saveWithOptions(String collection,
                                      JsonObject document,
                                      WriteOption writeOption,
                                      Handler<AsyncResult<String>> resultHandler)

      Save a document in the specified collection with the specified write option

      This operation might change _id field of document parameter

      Parameters:
        `collection` - the collection
        `document` - the document
        `writeOption` - the write option to use
        `resultHandler` - result handler will be provided with the id if document didn't already have one

    - #### saveWithOptions

          Future<String> saveWithOptions(String collection,
                                         JsonObject document,
                                         WriteOption writeOption)

    - #### insert

          MongoClient insert(String collection,
                             JsonObject document,
                             Handler<AsyncResult<String>> resultHandler)

      Insert a document in the specified collection

      This operation might change _id field of document parameter

      Parameters:
        `collection` - the collection
        `document` - the document
        `resultHandler` - result handler will be provided with the id if document didn't already have one

    - #### insert

          Future<String> insert(String collection,
                                JsonObject document)

    - #### insertWithOptions

          MongoClient insertWithOptions(String collection,
                                        JsonObject document,
                                        WriteOption writeOption,
                                        Handler<AsyncResult<String>> resultHandler)

      Insert a document in the specified collection with the specified write option

      This operation might change _id field of document parameter

      Parameters:
        `collection` - the collection
        `document` - the document
        `writeOption` - the write option to use
        `resultHandler` - result handler will be provided with the id if document didn't already have one

    - #### insertWithOptions

          Future<String> insertWithOptions(String collection,
                                           JsonObject document,
                                           WriteOption writeOption)

    - #### updateCollection

          MongoClient updateCollection(String collection,
                                       JsonObject query,
                                       JsonObject update,
                                       Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)

      Update matching documents in the specified collection and return the handler with MongoClientUpdateResult result
      Parameters:
        `collection` - the collection
        `query` - query used to match the documents
        `update` - used to describe how the documents will be updated
        `resultHandler` - will be called when complete

    - #### updateCollection

          Future<MongoClientUpdateResult> updateCollection(String collection,
                                                           JsonObject query,
                                                           JsonObject update)

    - #### updateCollectionWithOptions

          MongoClient updateCollectionWithOptions(String collection,
                                                  JsonObject query,
                                                  JsonObject update,
                                                  UpdateOptions options,
                                                  Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)

      Update matching documents in the specified collection, specifying options and return the handler with MongoClientUpdateResult result
      Parameters:
        `collection` - the collection
        `query` - query used to match the documents
        `update` - used to describe how the documents will be updated
        `options` - options to configure the update
        `resultHandler` - will be called when complete

    - #### updateCollectionWithOptions

          Future<MongoClientUpdateResult> updateCollectionWithOptions(String collection,
                                                                      JsonObject query,
                                                                      JsonObject update,
                                                                      UpdateOptions options)

    - #### replaceDocuments

          MongoClient replaceDocuments(String collection,
                                       JsonObject query,
                                       JsonObject replace,
                                       Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)

      Replace matching documents in the specified collection and return the handler with MongoClientUpdateResult result
      Parameters:
        `collection` - the collection
        `query` - query used to match the documents
        `replace` - all matching documents will be replaced with this
        `resultHandler` - will be called when complete

    - #### replaceDocuments

          Future<MongoClientUpdateResult> replaceDocuments(String collection,
                                                           JsonObject query,
                                                           JsonObject replace)

    - #### replaceDocumentsWithOptions

          MongoClient replaceDocumentsWithOptions(String collection,
                                                  JsonObject query,
                                                  JsonObject replace,
                                                  UpdateOptions options,
                                                  Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)

      Replace matching documents in the specified collection, specifying options and return the handler with MongoClientUpdateResult result
      Parameters:
        `collection` - the collection
        `query` - query used to match the documents
        `replace` - all matching documents will be replaced with this
        `options` - options to configure the replace
        `resultHandler` - will be called when complete

    - #### replaceDocumentsWithOptions

          Future<MongoClientUpdateResult> replaceDocumentsWithOptions(String collection,
                                                                      JsonObject query,
                                                                      JsonObject replace,
                                                                      UpdateOptions options)

    - #### bulkWrite

          MongoClient bulkWrite(String collection,
                                List<BulkOperation> operations,
                                Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)

      Execute a bulk operation. Can insert, update, replace, and/or delete multiple documents with one request.
      Parameters:
        `collection` - the collection
        `operations` - the operations to execute
        `resultHandler` - will be called with a `MongoClientBulkWriteResult` when complete

    - #### bulkWrite

          Future<MongoClientBulkWriteResult> bulkWrite(String collection,
                                                       List<BulkOperation> operations)

      Like `bulkWrite(String, List, Handler)` but returns a `Future` of the asynchronous result

    - #### bulkWriteWithOptions

          MongoClient bulkWriteWithOptions(String collection,
                                           List<BulkOperation> operations,
                                           BulkWriteOptions bulkWriteOptions,
                                           Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)

      Execute a bulk operation with the specified write options. Can insert, update, replace, and/or delete multiple documents with one request.
      Parameters:
        `collection` - the collection
        `operations` - the operations to execute
        `bulkWriteOptions` - the write options
        `resultHandler` - will be called with a `MongoClientBulkWriteResult` when complete

    - #### bulkWriteWithOptions

          Future<MongoClientBulkWriteResult> bulkWriteWithOptions(String collection,
                                                                  List<BulkOperation> operations,
                                                                  BulkWriteOptions bulkWriteOptions)

      Like `bulkWriteWithOptions(String, List, BulkWriteOptions, Handler)` but returns a `Future` of the asynchronous result

    - #### find

          MongoClient find(String collection,
                           JsonObject query,
                           Handler<AsyncResult<List<JsonObject>>> resultHandler)

      Find matching documents in the specified collection
      Parameters:
        `collection` - the collection
        `query` - query used to match documents
        `resultHandler` - will be provided with list of documents

    - #### find

          Future<List<JsonObject>> find(String collection,
                                        JsonObject query)

      Like `find(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result

    - #### findBatch

          ReadStream<JsonObject> findBatch(String collection,
                                           JsonObject query)

      Find matching documents in the specified collection. This method use batchCursor for returning each found document.
      Parameters:
        `collection` - the collection
        `query` - query used to match documents
      Returns:
        a `ReadStream` emitting found documents

    - #### findWithOptions

          MongoClient findWithOptions(String collection,
                                      JsonObject query,
                                      FindOptions options,
                                      Handler<AsyncResult<List<JsonObject>>> resultHandler)

      Find matching documents in the specified collection, specifying options
      Parameters:
        `collection` - the collection
        `query` - query used to match documents
        `options` - options to configure the find
        `resultHandler` - will be provided with list of documents

    - #### findWithOptions

          Future<List<JsonObject>> findWithOptions(String collection,
                                                   JsonObject query,
                                                   FindOptions options)

      Like `findWithOptions(String, JsonObject, FindOptions, Handler)` but returns a `Future` of the asynchronous result

    - #### findBatchWithOptions

          ReadStream<JsonObject> findBatchWithOptions(String collection,
                                                      JsonObject query,
                                                      FindOptions options)

      Find matching documents in the specified collection, specifying options. This method use batchCursor for returning each found document.
      Parameters:
        `collection` - the collection
        `query` - query used to match documents
        `options` - options to configure the find
      Returns:
        a `ReadStream` emitting found documents

    - #### findOne

          MongoClient findOne(String collection,
                              JsonObject query,
                              JsonObject fields,
                              Handler<AsyncResult<JsonObject>> resultHandler)

      Find a single matching document in the specified collection

      This operation might change _id field of query parameter

      Parameters:
        `collection` - the collection
        `query` - the query used to match the document
        `fields` - the fields
        `resultHandler` - will be provided with the document, if any

    - #### findOne

          Future<JsonObject> findOne(String collection,
                                     JsonObject query,
                                     JsonObject fields)

      Like `findOne(String, JsonObject, JsonObject, Handler)` but returns a `Future` of the asynchronous result

    - #### findOneAndUpdate

          MongoClient findOneAndUpdate(String collection,
                                       JsonObject query,
                                       JsonObject update,
                                       Handler<AsyncResult<JsonObject>> resultHandler)

      Find a single matching document in the specified collection and update it.

      This operation might change _id field of query parameter

      Parameters:
        `collection` - the collection
        `query` - the query used to match the document
        `update` - used to describe how the documents will be updated
        `resultHandler` - will be provided with the document, if any

    - #### findOneAndUpdate

          Future<JsonObject> findOneAndUpdate(String collection,
                                              JsonObject query,
                                              JsonObject update)

      Like `findOneAndUpdate(String, JsonObject, JsonObject, Handler)` but returns a `Future` of the asynchronous result

    - #### findOneAndUpdateWithOptions

          MongoClient findOneAndUpdateWithOptions(String collection,
                                                  JsonObject query,
                                                  JsonObject update,
                                                  FindOptions findOptions,
                                                  UpdateOptions updateOptions,
                                                  Handler<AsyncResult<JsonObject>> resultHandler)

      Find a single matching document in the specified collection and update it.

      This operation might change _id field of query parameter

      Parameters:
        `collection` - the collection
        `query` - the query used to match the document
        `update` - used to describe how the documents will be updated
        `findOptions` - options to configure the find
        `updateOptions` - options to configure the update
        `resultHandler` - will be provided with the document, if any

    - #### findOneAndUpdateWithOptions

          Future<JsonObject> findOneAndUpdateWithOptions(String collection,
                                                         JsonObject query,
                                                         JsonObject update,
                                                         FindOptions findOptions,
                                                         UpdateOptions updateOptions)

      Like `findOneAndUpdateWithOptions(String, JsonObject, JsonObject, FindOptions, UpdateOptions, Handler)` but returns a `Future` of the asynchronous result

    - #### findOneAndReplace

          MongoClient findOneAndReplace(String collection,
                                        JsonObject query,
                                        JsonObject replace,
                                        Handler<AsyncResult<JsonObject>> resultHandler)

      Find a single matching document in the specified collection and replace it.

      This operation might change _id field of query parameter

      Parameters:
        `collection` - the collection
        `query` - the query used to match the document
        `replace` - the replacement document
        `resultHandler` - will be provided with the document, if any

    - #### findOneAndReplace

          Future<JsonObject> findOneAndReplace(String collection,
                                               JsonObject query,
                                               JsonObject replace)

      Like `findOneAndReplace(String, JsonObject, JsonObject, Handler)` but returns a `Future` of the asynchronous result

    - #### findOneAndReplaceWithOptions

          MongoClient findOneAndReplaceWithOptions(String collection,
                                                   JsonObject query,
                                                   JsonObject replace,
                                                   FindOptions findOptions,
                                                   UpdateOptions updateOptions,
                                                   Handler<AsyncResult<JsonObject>> resultHandler)

      Find a single matching document in the specified collection and replace it.

      This operation might change _id field of query parameter

      Parameters:
        `collection` - the collection
        `query` - the query used to match the document
        `replace` - the replacement document
        `findOptions` - options to configure the find
        `updateOptions` - options to configure the update
        `resultHandler` - will be provided with the document, if any

    - #### findOneAndReplaceWithOptions

          Future<JsonObject> findOneAndReplaceWithOptions(String collection,
                                                          JsonObject query,
                                                          JsonObject replace,
                                                          FindOptions findOptions,
                                                          UpdateOptions updateOptions)

      Like `findOneAndReplaceWithOptions(String, JsonObject, JsonObject, FindOptions, UpdateOptions, Handler)` but returns a `Future` of the asynchronous result

    - #### findOneAndDelete

          MongoClient findOneAndDelete(String collection,
                                       JsonObject query,
                                       Handler<AsyncResult<JsonObject>> resultHandler)

      Find a single matching document in the specified collection and delete it.

      This operation might change _id field of query parameter

      Parameters:
        `collection` - the collection
        `query` - the query used to match the document
        `resultHandler` - will be provided with the deleted document, if any

    - #### findOneAndDelete

          Future<JsonObject> findOneAndDelete(String collection,
                                              JsonObject query)

      Like `findOneAndDelete(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result

    - #### findOneAndDeleteWithOptions

          MongoClient findOneAndDeleteWithOptions(String collection,
                                                  JsonObject query,
                                                  FindOptions findOptions,
                                                  Handler<AsyncResult<JsonObject>> resultHandler)

      Find a single matching document in the specified collection and delete it.

      This operation might change _id field of query parameter

      Parameters:
        `collection` - the collection
        `query` - the query used to match the document
        `findOptions` - options to configure the find
        `resultHandler` - will be provided with the deleted document, if any

    - #### findOneAndDeleteWithOptions

          Future<JsonObject> findOneAndDeleteWithOptions(String collection,
                                                         JsonObject query,
                                                         FindOptions findOptions)

      Like `findOneAndDeleteWithOptions(String, JsonObject, FindOptions, Handler)` but returns a `Future` of the asynchronous result

    - #### count

          MongoClient count(String collection,
                            JsonObject query,
                            Handler<AsyncResult<Long>> resultHandler)

      Count matching documents in a collection.
      Parameters:
        `collection` - the collection
        `query` - query used to match documents
        `resultHandler` - will be provided with the number of matching documents

    - #### count

          Future<Long> count(String collection,
                             JsonObject query)

      Like `count(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result

    - #### removeDocuments

          MongoClient removeDocuments(String collection,
                                      JsonObject query,
                                      Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)

      Remove matching documents from a collection and return the handler with MongoClientDeleteResult result
      Parameters:
        `collection` - the collection
        `query` - query used to match documents
        `resultHandler` - will be called when complete

    - #### removeDocuments

          Future<MongoClientDeleteResult> removeDocuments(String collection,
                                                          JsonObject query)

      Like `removeDocuments(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result

    - #### removeDocumentsWithOptions

          MongoClient removeDocumentsWithOptions(String collection,
                                                 JsonObject query,
                                                 WriteOption writeOption,
                                                 Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)

      Remove matching documents from a collection with the specified write option and return the handler with MongoClientDeleteResult result
      Parameters:
        `collection` - the collection
        `query` - query used to match documents
        `writeOption` - the write option to use
        `resultHandler` - will be called when complete

    - #### removeDocumentsWithOptions

          Future<MongoClientDeleteResult> removeDocumentsWithOptions(String collection,
                                                                     JsonObject query,
                                                                     WriteOption writeOption)

      Like `removeDocumentsWithOptions(String, JsonObject, WriteOption, Handler)` but returns a `Future` of the asynchronous result

    - #### removeDocument

          MongoClient removeDocument(String collection,
                                     JsonObject query,
                                     Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)

      Remove a single matching document from a collection and return the handler with MongoClientDeleteResult result
      Parameters:
        `collection` - the collection
        `query` - query used to match document
        `resultHandler` - will be called when complete

    - #### removeDocument

          Future<MongoClientDeleteResult> removeDocument(String collection,
                                                         JsonObject query)

      Like `removeDocument(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result

    - #### removeDocumentWithOptions

          MongoClient removeDocumentWithOptions(String collection,
                                                JsonObject query,
                                                WriteOption writeOption,
                                                Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)

      Remove a single matching document from a collection with the specified write option and return the handler with MongoClientDeleteResult result
      Parameters:
        `collection` - the collection
        `query` - query used to match document
        `writeOption` - the write option to use
        `resultHandler` - will be called when complete

    - #### removeDocumentWithOptions

          Future<MongoClientDeleteResult> removeDocumentWithOptions(String collection,
                                                                    JsonObject query,
                                                                    WriteOption writeOption)

      Like `removeDocumentWithOptions(String, JsonObject, WriteOption, Handler)` but returns a `Future` of the asynchronous result

    - #### createCollection

          MongoClient createCollection(String collectionName,
                                       Handler<AsyncResult<Void>> resultHandler)

      Create a new collection
      Parameters:
        `collectionName` - the name of the collection
        `resultHandler` - will be called when complete

    - #### createCollection

          Future<Void> createCollection(String collectionName)

      Like `createCollection(String, Handler)` but returns a `Future` of the asynchronous result

    - #### getCollections

          MongoClient getCollections(Handler<AsyncResult<List<String>>> resultHandler)

      Get a list of all collections in the database.
      Parameters:
        `resultHandler` - will be called with a list of collections.

    - #### getCollections

          Future<List<String>> getCollections()

      Like `getCollections(Handler)` but returns a `Future` of the asynchronous result

    - #### dropCollection

          MongoClient dropCollection(String collection,
                                     Handler<AsyncResult<Void>> resultHandler)

      Drop a collection
      Parameters:
        `collection` - the collection
        `resultHandler` - will be called when complete

    - #### dropCollection

          Future<Void> dropCollection(String collection)

      Like `dropCollection(String, Handler)` but returns a `Future` of the asynchronous result

    - #### createIndex

          MongoClient createIndex(String collection,
                                  JsonObject key,
                                  Handler<AsyncResult<Void>> resultHandler)

      Creates an index.
      Parameters:
        `collection` - the collection
        `key` - A document that contains the field and value pairs where the field is the index key and the value describes the type of index for that field. For an ascending index on a field, specify a value of 1; for descending index, specify a value of -1.
        `resultHandler` - will be called when complete

    - #### createIndex

          Future<Void> createIndex(String collection,
                                   JsonObject key)

      Like `createIndex(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result

    - #### createIndexWithOptions

          MongoClient createIndexWithOptions(String collection,
                                             JsonObject key,
                                             IndexOptions options,
                                             Handler<AsyncResult<Void>> resultHandler)

      Creates an index.
      Parameters:
        `collection` - the collection
        `key` - A document that contains the field and value pairs where the field is the index key and the value describes the type of index for that field. For an ascending index on a field, specify a value of 1; for descending index, specify a value of -1.
        `options` - the options for the index
        `resultHandler` - will be called when complete

    - #### createIndexWithOptions

          Future<Void> createIndexWithOptions(String collection,
                                              JsonObject key,
                                              IndexOptions options)

      Like `createIndexWithOptions(String, JsonObject, IndexOptions, Handler)` but returns a `Future` of the asynchronous result

    - #### createIndexes

          MongoClient createIndexes(String collection,
                                    List<IndexModel> indexes,
                                    Handler<AsyncResult<Void>> resultHandler)

      creates an indexes
      Parameters:
        `collection` - the collection
        `indexes` - A model that contains pairs of document and indexOptions, document contains the field and value pairs where the field is the index key and the value describes the type of index for that field. For an ascending index on a field, specify a value of 1; for descending index, specify a value of -1.
        `resultHandler` - will be called when complete

    - #### createIndexes

          Future<Void> createIndexes(String collection,
                                     List<IndexModel> indexes)

      Like `createIndexes(String, List, Handler)` but returns a `Future` of the asynchronous result

    - #### listIndexes

          MongoClient listIndexes(String collection,
                                  Handler<AsyncResult<JsonArray>> resultHandler)

      Get all the indexes in this collection.
      Parameters:
        `collection` - the collection
        `resultHandler` - will be called when complete

    - #### listIndexes

          Future<JsonArray> listIndexes(String collection)

      Like `listIndexes(String, Handler)` but returns a `Future` of the asynchronous result

    - #### dropIndex

          MongoClient dropIndex(String collection,
                                String indexName,
                                Handler<AsyncResult<Void>> resultHandler)

      Drops the index given its name.
      Parameters:
        `collection` - the collection
        `indexName` - the name of the index to remove
        `resultHandler` - will be called when complete

    - #### dropIndex

          Future<Void> dropIndex(String collection,
                                 String indexName)

      Like `dropIndex(String, String, Handler)` but returns a `Future` of the asynchronous result

    - #### runCommand

          MongoClient runCommand(String commandName,
                                 JsonObject command,
                                 Handler<AsyncResult<JsonObject>> resultHandler)

      Run an arbitrary MongoDB command.
      Parameters:
        `commandName` - the name of the command
        `command` - the command
        `resultHandler` - will be called with the result.

    - #### runCommand

          Future<JsonObject> runCommand(String commandName,
                                        JsonObject command)

      Like `runCommand(String, JsonObject, Handler)` but returns a `Future` of the asynchronous result

    - #### distinct

          MongoClient distinct(String collection,
                               String fieldName,
                               String resultClassname,
                               Handler<AsyncResult<JsonArray>> resultHandler)

      Gets the distinct values of the specified field name. Return a JsonArray containing distinct values (eg: [ 1 , 89 ])
      Parameters:
        `collection` - the collection
        `fieldName` - the field name
        `resultHandler` - will be provided with array of values.

    - #### distinct

          Future<JsonArray> distinct(String collection,
                                     String fieldName,
                                     String resultClassname)

      Like `distinct(String, String, String, Handler)` but returns a `Future` of the asynchronous result

    - #### distinctWithQuery

          MongoClient distinctWithQuery(String collection,
                                        String fieldName,
                                        String resultClassname,
                                        JsonObject query,
                                        Handler<AsyncResult<JsonArray>> resultHandler)

      Gets the distinct values of the specified field name filtered by specified query. Return a JsonArray containing distinct values (eg: [ 1 , 89 ])
      Parameters:
        `collection` - the collection
        `fieldName` - the field name
        `query` - the query
        `resultHandler` - will be provided with array of values.

    - #### distinctWithQuery

          Future<JsonArray> distinctWithQuery(String collection,
                                              String fieldName,
                                              String resultClassname,
                                              JsonObject query)

      Like `distinctWithQuery(String, String, String, JsonObject, Handler)` but returns a `Future` of the asynchronous result

    - #### distinctBatch

          ReadStream<JsonObject> distinctBatch(String collection,
                                               String fieldName,
                                               String resultClassname)

      Gets the distinct values of the specified field name. This method use batchCursor for returning each found value. Each value is a json fragment with fieldName key (eg: {"num": 1}).
      Parameters:
        `collection` - the collection
        `fieldName` - the field name
      Returns:
        a `ReadStream` emitting json fragments

    - #### distinctBatchWithQuery

          ReadStream<JsonObject> distinctBatchWithQuery(String collection,
                                                        String fieldName,
                                                        String resultClassname,
                                                        JsonObject query)

      Gets the distinct values of the specified field name filtered by specified query. This method use batchCursor for returning each found value. Each value is a json fragment with fieldName key (eg: {"num": 1}).
      Parameters:
        `collection` - the collection
        `fieldName` - the field name
        `query` - the query
      Returns:
        a `ReadStream` emitting json fragments

    - #### distinctBatchWithQuery

          ReadStream<JsonObject> distinctBatchWithQuery(String collection,
                                                        String fieldName,
                                                        String resultClassname,
                                                        JsonObject query,
                                                        int batchSize)

      Gets the distinct values of the specified field name filtered by specified query. This method use batchCursor for returning each found value. Each value is a json fragment with fieldName key (eg: {"num": 1}).
      Parameters:
        `collection` - the collection
        `fieldName` - the field name
        `query` - the query
        `batchSize` - the number of documents to load in a batch
      Returns:
        a `ReadStream` emitting json fragments

    - #### aggregate

          ReadStream<JsonObject> aggregate(String collection,
                                           JsonArray pipeline)

      Run aggregate MongoDB command with default `AggregateOptions`.
      Parameters:
        `collection` - the collection
        `pipeline` - aggregation pipeline to be executed

    - #### aggregateWithOptions

          ReadStream<JsonObject> aggregateWithOptions(String collection,
                                                      JsonArray pipeline,
                                                      AggregateOptions options)

      Run aggregate MongoDB command.
      Parameters:
        `collection` - the collection
        `pipeline` - aggregation pipeline to be executed
        `options` - options to configure the aggregation command

    - #### createDefaultGridFsBucketService

          MongoClient createDefaultGridFsBucketService(Handler<AsyncResult<MongoGridFsClient>> resultHandler)

      Creates a `MongoGridFsClient` used to interact with Mongo GridFS.
      Parameters:
        `resultHandler` - the `MongoGridFsClient` to interact with the bucket named bucketName

    - #### createDefaultGridFsBucketService

          Future<MongoGridFsClient> createDefaultGridFsBucketService()

      Like `createDefaultGridFsBucketService(Handler)` but returns a `Future` of the asynchronous result

    - #### createGridFsBucketService

          MongoClient createGridFsBucketService(String bucketName,
                                                Handler<AsyncResult<MongoGridFsClient>> resultHandler)

      Creates a `MongoGridFsClient` used to interact with Mongo GridFS.
      Parameters:
        `bucketName` - the name of the GridFS bucket
        `resultHandler` - the `MongoGridFsClient` to interact with the bucket named bucketName

    - #### createGridFsBucketService

          Future<MongoGridFsClient> createGridFsBucketService(String bucketName)

      Like `createGridFsBucketService(String, Handler)` but returns a `Future` of the asynchronous result

    - #### close

          Future<Void> close()

      Like `close(Handler)` but returns a `Future` of the asynchronous result

    - #### close

          void close(Handler<AsyncResult<Void>> handler)

      Close the client and release its resources

Copyright © 2020 Eclipse. All rights reserved.