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 Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `MongoClient` | `bulkWrite(String collection, List<BulkOperation> operations, Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)` Execute a bulk operation.
    `MongoClient` | `bulkWriteWithOptions(String collection, List<BulkOperation> operations, BulkWriteOptions bulkWriteOptions, Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)` Execute a bulk operation with the specified write options.
    `void` | `close()` Close the client and release its resources
    `MongoClient` | `count(String collection, JsonObject query, Handler<AsyncResult<Long>> resultHandler)` Count matching documents in a collection.
    `MongoClient` | `createCollection(String collectionName, Handler<AsyncResult<Void>> resultHandler)` Create a new collection
    `MongoClient` | `createIndex(String collection, JsonObject key, Handler<AsyncResult<Void>> resultHandler)` Creates an index.
    `MongoClient` | `createIndexWithOptions(String collection, JsonObject key, IndexOptions options, Handler<AsyncResult<Void>> resultHandler)` Creates an index.
    `static MongoClient` | `createNonShared(Vertx vertx, JsonObject config)` Create a Mongo client which maintains its own data source.
    `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
    `MongoClient` | `distinct(String collection, String fieldName, String resultClassname, Handler<AsyncResult<JsonArray>> resultHandler)` Gets the distinct values of the specified field name.
    `MongoClient` | `distinctBatch(String collection, String fieldName, String resultClassname, Handler<AsyncResult<JsonObject>> resultHandler)` Gets the distinct values of the specified field name.
    `MongoClient` | `dropCollection(String collection, Handler<AsyncResult<Void>> resultHandler)` Drop a collection
    `MongoClient` | `dropIndex(String collection, String indexName, Handler<AsyncResult<Void>> resultHandler)` Drops the index given its name.
    `MongoClient` | `find(String collection, JsonObject query, Handler<AsyncResult<List<JsonObject>>> resultHandler)` Find matching documents in the specified collection
    `MongoClient` | `findBatch(String collection, JsonObject query, Handler<AsyncResult<JsonObject>> resultHandler)` Find matching documents in the specified collection.
    `MongoClient` | `findBatchWithOptions(String collection, JsonObject query, FindOptions options, Handler<AsyncResult<JsonObject>> resultHandler)` Find matching documents in the specified collection, specifying options.
    `MongoClient` | `findOne(String collection, JsonObject query, JsonObject fields, Handler<AsyncResult<JsonObject>> resultHandler)` Find a single matching document in the specified collection
    `MongoClient` | `findOneAndDelete(String collection, JsonObject query, Handler<AsyncResult<JsonObject>> resultHandler)` Find a single matching document in the specified collection and delete it.
    `MongoClient` | `findOneAndDeleteWithOptions(String collection, JsonObject query, FindOptions findOptions, Handler<AsyncResult<JsonObject>> resultHandler)` Find a single matching document in the specified collection and delete it.
    `MongoClient` | `findOneAndReplace(String collection, JsonObject query, JsonObject replace, Handler<AsyncResult<JsonObject>> resultHandler)` Find a single matching document in the specified collection and replace it.
    `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.
    `MongoClient` | `findOneAndUpdate(String collection, JsonObject query, JsonObject update, Handler<AsyncResult<JsonObject>> resultHandler)` Find a single matching document in the specified collection and update it.
    `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.
    `MongoClient` | `findWithOptions(String collection, JsonObject query, FindOptions options, Handler<AsyncResult<List<JsonObject>>> resultHandler)` Find matching documents in the specified collection, specifying options
    `MongoClient` | `getCollections(Handler<AsyncResult<List<String>>> resultHandler)` Get a list of all collections in the database.
    `MongoClient` | `insert(String collection, JsonObject document, Handler<AsyncResult<String>> resultHandler)` Insert a document in the specified collection
    `MongoClient` | `insertWithOptions(String collection, JsonObject document, WriteOption writeOption, Handler<AsyncResult<String>> resultHandler)` Insert a document in the specified collection with the specified write option
    `MongoClient` | `listIndexes(String collection, Handler<AsyncResult<JsonArray>> resultHandler)` Get all the indexes in this collection.
    `MongoClient` | `remove(String collection, JsonObject query, Handler<AsyncResult<Void>> resultHandler)` Deprecated.
    `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
    `MongoClient` | `removeDocuments(String collection, JsonObject query, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)` Remove matching documents from a collection and return the handler with MongoClientDeleteResult 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
    `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
    `MongoClient` | `removeOne(String collection, JsonObject query, Handler<AsyncResult<Void>> resultHandler)` Deprecated.
    `MongoClient` | `removeOneWithOptions(String collection, JsonObject query, WriteOption writeOption, Handler<AsyncResult<Void>> resultHandler)` Deprecated.
    `MongoClient` | `removeWithOptions(String collection, JsonObject query, WriteOption writeOption, Handler<AsyncResult<Void>> resultHandler)` Deprecated.
    `MongoClient` | `replace(String collection, JsonObject query, JsonObject replace, Handler<AsyncResult<Void>> resultHandler)` Deprecated.
    `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
    `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
    `MongoClient` | `replaceWithOptions(String collection, JsonObject query, JsonObject replace, UpdateOptions options, Handler<AsyncResult<Void>> resultHandler)` Deprecated.
    `MongoClient` | `runCommand(String commandName, JsonObject command, Handler<AsyncResult<JsonObject>> resultHandler)` Run an arbitrary MongoDB command.
    `MongoClient` | `save(String collection, JsonObject document, Handler<AsyncResult<String>> resultHandler)` Save a document in the specified collection
    `MongoClient` | `saveWithOptions(String collection, JsonObject document, WriteOption writeOption, Handler<AsyncResult<String>> resultHandler)` Save a document in the specified collection with the specified write option
    `MongoClient` | `update(String collection, JsonObject query, JsonObject update, Handler<AsyncResult<Void>> resultHandler)` Deprecated.
    `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
    `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
    `MongoClient` | `updateWithOptions(String collection, JsonObject query, JsonObject update, UpdateOptions options, Handler<AsyncResult<Void>> resultHandler)` Deprecated.

- - ### 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

    - #### createNonShared

          static MongoClient createNonShared(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

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### update

          @Deprecated
          MongoClient update(String collection,
                                         JsonObject query,
                                         JsonObject update,
                                         Handler<AsyncResult<Void>> resultHandler)

      Deprecated.
      Update matching documents in the specified collection
      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

          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

    - #### updateWithOptions

          @Deprecated
          MongoClient updateWithOptions(String collection,
                                                    JsonObject query,
                                                    JsonObject update,
                                                    UpdateOptions options,
                                                    Handler<AsyncResult<Void>> resultHandler)

      Deprecated.
      Update matching documents in the specified collection, specifying options
      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

          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

    - #### replace

          @Deprecated
          MongoClient replace(String collection,
                                          JsonObject query,
                                          JsonObject replace,
                                          Handler<AsyncResult<Void>> resultHandler)

      Deprecated.
      Replace matching documents in the specified collection

      This operation might change _id field of replace parameter

      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

          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

    - #### replaceWithOptions

          @Deprecated
          MongoClient replaceWithOptions(String collection,
                                                     JsonObject query,
                                                     JsonObject replace,
                                                     UpdateOptions options,
                                                     Handler<AsyncResult<Void>> resultHandler)

      Deprecated.
      Replace matching documents in the specified collection, specifying options

      This operation might change _id field of replace parameter

      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

          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

    - #### 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

    - #### 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

    - #### 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

    - #### findBatch

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

      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
        `resultHandler` - will be provided with each found document

    - #### 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

    - #### findBatchWithOptions

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

      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
        `resultHandler` - will be provided with each found document

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### remove

          @Deprecated
          MongoClient remove(String collection,
                                         JsonObject query,
                                         Handler<AsyncResult<Void>> resultHandler)

      Deprecated.
      Remove matching documents from a collection
      Parameters:
        `collection` - the collection
        `query` - query used to match documents
        `resultHandler` - will be called when complete

    - #### 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

    - #### removeWithOptions

          @Deprecated
          MongoClient removeWithOptions(String collection,
                                                    JsonObject query,
                                                    WriteOption writeOption,
                                                    Handler<AsyncResult<Void>> resultHandler)

      Deprecated.
      Remove matching documents from a collection with the specified write option
      Parameters:
        `collection` - the collection
        `query` - query used to match documents
        `writeOption` - the write option to use
        `resultHandler` - will be called when complete

    - #### 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

    - #### removeOne

          @Deprecated
          MongoClient removeOne(String collection,
                                            JsonObject query,
                                            Handler<AsyncResult<Void>> resultHandler)

      Deprecated.
      Remove a single matching document from a collection
      Parameters:
        `collection` - the collection
        `query` - query used to match document
        `resultHandler` - will be called when complete

    - #### 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

    - #### removeOneWithOptions

          @Deprecated
          MongoClient removeOneWithOptions(String collection,
                                                       JsonObject query,
                                                       WriteOption writeOption,
                                                       Handler<AsyncResult<Void>> resultHandler)

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

    - #### 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

    - #### 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

    - #### 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.

    - #### dropCollection

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

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

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### 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.

    - #### 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.

    - #### distinctBatch

          MongoClient distinctBatch(String collection,
                                    String fieldName,
                                    String resultClassname,
                                    Handler<AsyncResult<JsonObject>> resultHandler)

      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
        `resultHandler` - will be provided with each found value

    - #### close

          void close()

      Close the client and release its resources

Copyright © 2017. All rights reserved.