Class MongoClient


  • public class MongoClient
    extends Object
    A Vert.x service used to interact with MongoDB server instances.

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

    NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

    • Constructor Detail

      • MongoClient

        public MongoClient​(io.vertx.ext.mongo.MongoClient delegate)
      • MongoClient

        public MongoClient​(Object delegate)
    • Method Detail

      • getDelegate

        public io.vertx.ext.mongo.MongoClient getDelegate()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • create

        public static MongoClient create​(Vertx vertx,
                                         io.vertx.core.json.JsonObject config)
        Parameters:
        vertx - the Vert.x instance
        config - the configuration
        Returns:
        the client
      • createShared

        public static MongoClient createShared​(Vertx vertx,
                                               io.vertx.core.json.JsonObject config,
                                               String dataSourceName)
        Parameters:
        vertx - the Vert.x instance
        config - the configuration
        dataSourceName - the data source name
        Returns:
        the client
      • createShared

        public static MongoClient createShared​(Vertx vertx,
                                               io.vertx.core.json.JsonObject config)
        Parameters:
        vertx - the Vert.x instance
        config - the configuration
        Returns:
        the client
      • save

        public io.smallrye.mutiny.Uni<String> save​(String collection,
                                                   io.vertx.core.json.JsonObject document)
        Save a document in the specified collection

        This operation might change _id field of document parameter

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        document - the document
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • saveAndAwait

        public String saveAndAwait​(String collection,
                                   io.vertx.core.json.JsonObject document)
        Blocking variant of save(String,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        document - the document
        Returns:
        the String instance produced by the operation.
      • saveAndForget

        public MongoClient saveAndForget​(String collection,
                                         io.vertx.core.json.JsonObject document)
        Variant of save(String,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of save(String,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from save(String,JsonObject) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        document - the document
        Returns:
        the instance of MongoClient to chain method calls.
      • saveWithOptions

        public io.smallrye.mutiny.Uni<String> saveWithOptions​(String collection,
                                                              io.vertx.core.json.JsonObject document,
                                                              io.vertx.ext.mongo.WriteOption writeOption)
        Save a document in the specified collection with the specified write option

        This operation might change _id field of document parameter

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        document - the document
        writeOption - the write option to use
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • saveWithOptionsAndAwait

        public String saveWithOptionsAndAwait​(String collection,
                                              io.vertx.core.json.JsonObject document,
                                              io.vertx.ext.mongo.WriteOption writeOption)
        Blocking variant of saveWithOptions(String,JsonObject,WriteOption).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        document - the document
        writeOption - the write option to use
        Returns:
        the String instance produced by the operation.
      • insert

        public io.smallrye.mutiny.Uni<String> insert​(String collection,
                                                     io.vertx.core.json.JsonObject document)
        Insert a document in the specified collection

        This operation might change _id field of document parameter

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        document - the document
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • insertAndAwait

        public String insertAndAwait​(String collection,
                                     io.vertx.core.json.JsonObject document)
        Blocking variant of insert(String,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        document - the document
        Returns:
        the String instance produced by the operation.
      • insertAndForget

        public MongoClient insertAndForget​(String collection,
                                           io.vertx.core.json.JsonObject document)
        Variant of insert(String,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of insert(String,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from insert(String,JsonObject) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        document - the document
        Returns:
        the instance of MongoClient to chain method calls.
      • insertWithOptions

        public io.smallrye.mutiny.Uni<String> insertWithOptions​(String collection,
                                                                io.vertx.core.json.JsonObject document,
                                                                io.vertx.ext.mongo.WriteOption writeOption)
        Insert a document in the specified collection with the specified write option

        This operation might change _id field of document parameter

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        document - the document
        writeOption - the write option to use
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • insertWithOptionsAndAwait

        public String insertWithOptionsAndAwait​(String collection,
                                                io.vertx.core.json.JsonObject document,
                                                io.vertx.ext.mongo.WriteOption writeOption)
        Blocking variant of insertWithOptions(String,JsonObject,WriteOption).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        document - the document
        writeOption - the write option to use
        Returns:
        the String instance produced by the operation.
      • updateCollection

        public io.smallrye.mutiny.Uni<io.vertx.ext.mongo.MongoClientUpdateResult> updateCollection​(String collection,
                                                                                                   io.vertx.core.json.JsonObject query,
                                                                                                   io.vertx.core.json.JsonObject update)
        Update matching documents in the specified collection and return the handler with MongoClientUpdateResult result

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - query used to match the documents
        update - used to describe how the documents will be updated
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • updateCollectionAndAwait

        public io.vertx.ext.mongo.MongoClientUpdateResult updateCollectionAndAwait​(String collection,
                                                                                   io.vertx.core.json.JsonObject query,
                                                                                   io.vertx.core.json.JsonObject update)
        Blocking variant of updateCollection(String,JsonObject,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - query used to match the documents
        update - used to describe how the documents will be updated
        Returns:
        the MongoClientUpdateResult instance produced by the operation.
      • updateCollectionAndForget

        public MongoClient updateCollectionAndForget​(String collection,
                                                     io.vertx.core.json.JsonObject query,
                                                     io.vertx.core.json.JsonObject update)
        Variant of updateCollection(String,JsonObject,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of updateCollection(String,JsonObject,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from updateCollection(String,JsonObject,JsonObject) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        query - query used to match the documents
        update - used to describe how the documents will be updated
        Returns:
        the instance of MongoClient to chain method calls.
      • updateCollection

        public io.smallrye.mutiny.Uni<io.vertx.ext.mongo.MongoClientUpdateResult> updateCollection​(String collection,
                                                                                                   io.vertx.core.json.JsonObject query,
                                                                                                   io.vertx.core.json.JsonArray update)
        Use an aggregation pipeline to update documents in the specified collection and return the handler with MongoClientUpdateResult result

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - query used to match the documents
        update - used to describe how the documents will be updated
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • updateCollectionAndAwait

        public io.vertx.ext.mongo.MongoClientUpdateResult updateCollectionAndAwait​(String collection,
                                                                                   io.vertx.core.json.JsonObject query,
                                                                                   io.vertx.core.json.JsonArray update)
        Blocking variant of updateCollection(String,JsonObject,JsonArray).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - query used to match the documents
        update - used to describe how the documents will be updated
        Returns:
        the MongoClientUpdateResult instance produced by the operation.
      • updateCollectionAndForget

        public MongoClient updateCollectionAndForget​(String collection,
                                                     io.vertx.core.json.JsonObject query,
                                                     io.vertx.core.json.JsonArray update)
        Variant of updateCollection(String,JsonObject,JsonArray) that ignores the result of the operation.

        This method subscribes on the result of updateCollection(String,JsonObject,JsonArray), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from updateCollection(String,JsonObject,JsonArray) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        query - query used to match the documents
        update - used to describe how the documents will be updated
        Returns:
        the instance of MongoClient to chain method calls.
      • updateCollectionWithOptions

        public io.smallrye.mutiny.Uni<io.vertx.ext.mongo.MongoClientUpdateResult> updateCollectionWithOptions​(String collection,
                                                                                                              io.vertx.core.json.JsonObject query,
                                                                                                              io.vertx.core.json.JsonObject update,
                                                                                                              io.vertx.ext.mongo.UpdateOptions options)
        Update matching documents in the specified collection, specifying options and return the handler with MongoClientUpdateResult result

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        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
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • updateCollectionWithOptionsAndAwait

        public io.vertx.ext.mongo.MongoClientUpdateResult updateCollectionWithOptionsAndAwait​(String collection,
                                                                                              io.vertx.core.json.JsonObject query,
                                                                                              io.vertx.core.json.JsonObject update,
                                                                                              io.vertx.ext.mongo.UpdateOptions options)
        Blocking variant of updateCollectionWithOptions(String,JsonObject,JsonObject,UpdateOptions).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        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
        Returns:
        the MongoClientUpdateResult instance produced by the operation.
      • updateCollectionWithOptions

        public io.smallrye.mutiny.Uni<io.vertx.ext.mongo.MongoClientUpdateResult> updateCollectionWithOptions​(String collection,
                                                                                                              io.vertx.core.json.JsonObject query,
                                                                                                              io.vertx.core.json.JsonArray update,
                                                                                                              io.vertx.ext.mongo.UpdateOptions options)
        Use an aggregation pipeline to update documents in the specified collection, specifying options and return the handler with MongoClientUpdateResult result

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - query used to match the documents
        update - aggregation pipeline used to describe how documents will be updated
        options - options to configure the update
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • updateCollectionWithOptionsAndAwait

        public io.vertx.ext.mongo.MongoClientUpdateResult updateCollectionWithOptionsAndAwait​(String collection,
                                                                                              io.vertx.core.json.JsonObject query,
                                                                                              io.vertx.core.json.JsonArray update,
                                                                                              io.vertx.ext.mongo.UpdateOptions options)
        Blocking variant of updateCollectionWithOptions(String,JsonObject,JsonArray,UpdateOptions).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - query used to match the documents
        update - aggregation pipeline used to describe how documents will be updated
        options - options to configure the update
        Returns:
        the MongoClientUpdateResult instance produced by the operation.
      • replaceDocuments

        public io.smallrye.mutiny.Uni<io.vertx.ext.mongo.MongoClientUpdateResult> replaceDocuments​(String collection,
                                                                                                   io.vertx.core.json.JsonObject query,
                                                                                                   io.vertx.core.json.JsonObject replace)
        Replace matching documents in the specified collection and return the handler with MongoClientUpdateResult result

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - query used to match the documents
        replace - all matching documents will be replaced with this
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • replaceDocumentsAndAwait

        public io.vertx.ext.mongo.MongoClientUpdateResult replaceDocumentsAndAwait​(String collection,
                                                                                   io.vertx.core.json.JsonObject query,
                                                                                   io.vertx.core.json.JsonObject replace)
        Blocking variant of replaceDocuments(String,JsonObject,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - query used to match the documents
        replace - all matching documents will be replaced with this
        Returns:
        the MongoClientUpdateResult instance produced by the operation.
      • replaceDocumentsAndForget

        public MongoClient replaceDocumentsAndForget​(String collection,
                                                     io.vertx.core.json.JsonObject query,
                                                     io.vertx.core.json.JsonObject replace)
        Variant of replaceDocuments(String,JsonObject,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of replaceDocuments(String,JsonObject,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from replaceDocuments(String,JsonObject,JsonObject) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        query - query used to match the documents
        replace - all matching documents will be replaced with this
        Returns:
        the instance of MongoClient to chain method calls.
      • replaceDocumentsWithOptions

        public io.smallrye.mutiny.Uni<io.vertx.ext.mongo.MongoClientUpdateResult> replaceDocumentsWithOptions​(String collection,
                                                                                                              io.vertx.core.json.JsonObject query,
                                                                                                              io.vertx.core.json.JsonObject replace,
                                                                                                              io.vertx.ext.mongo.UpdateOptions options)
        Replace matching documents in the specified collection, specifying options and return the handler with MongoClientUpdateResult result

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        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
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • replaceDocumentsWithOptionsAndAwait

        public io.vertx.ext.mongo.MongoClientUpdateResult replaceDocumentsWithOptionsAndAwait​(String collection,
                                                                                              io.vertx.core.json.JsonObject query,
                                                                                              io.vertx.core.json.JsonObject replace,
                                                                                              io.vertx.ext.mongo.UpdateOptions options)
        Blocking variant of replaceDocumentsWithOptions(String,JsonObject,JsonObject,UpdateOptions).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        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
        Returns:
        the MongoClientUpdateResult instance produced by the operation.
      • bulkWrite

        public io.smallrye.mutiny.Uni<io.vertx.ext.mongo.MongoClientBulkWriteResult> bulkWrite​(String collection,
                                                                                               List<io.vertx.ext.mongo.BulkOperation> operations)
        Execute a bulk operation. Can insert, update, replace, and/or delete multiple documents with one request.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        operations - the operations to execute
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • bulkWriteAndAwait

        public io.vertx.ext.mongo.MongoClientBulkWriteResult bulkWriteAndAwait​(String collection,
                                                                               List<io.vertx.ext.mongo.BulkOperation> operations)
        Blocking variant of io.vertx.mutiny.ext.mongo.MongoClient#bulkWrite(String,List).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        operations - the operations to execute
        Returns:
        the MongoClientBulkWriteResult instance produced by the operation.
      • bulkWriteAndForget

        public MongoClient bulkWriteAndForget​(String collection,
                                              List<io.vertx.ext.mongo.BulkOperation> operations)
        Variant of io.vertx.mutiny.ext.mongo.MongoClient#bulkWrite(String,List) that ignores the result of the operation.

        This method subscribes on the result of io.vertx.mutiny.ext.mongo.MongoClient#bulkWrite(String,List), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from io.vertx.mutiny.ext.mongo.MongoClient#bulkWrite(String,List) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        operations - the operations to execute
        Returns:
        the instance of MongoClient to chain method calls.
      • bulkWriteWithOptions

        public io.smallrye.mutiny.Uni<io.vertx.ext.mongo.MongoClientBulkWriteResult> bulkWriteWithOptions​(String collection,
                                                                                                          List<io.vertx.ext.mongo.BulkOperation> operations,
                                                                                                          io.vertx.ext.mongo.BulkWriteOptions bulkWriteOptions)
        Execute a bulk operation with the specified write options. Can insert, update, replace, and/or delete multiple documents with one request.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        operations - the operations to execute
        bulkWriteOptions - the write options
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • bulkWriteWithOptionsAndAwait

        public io.vertx.ext.mongo.MongoClientBulkWriteResult bulkWriteWithOptionsAndAwait​(String collection,
                                                                                          List<io.vertx.ext.mongo.BulkOperation> operations,
                                                                                          io.vertx.ext.mongo.BulkWriteOptions bulkWriteOptions)
        Blocking variant of io.vertx.mutiny.ext.mongo.MongoClient#bulkWriteWithOptions(String,List,BulkWriteOptions).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        operations - the operations to execute
        bulkWriteOptions - the write options
        Returns:
        the MongoClientBulkWriteResult instance produced by the operation.
      • bulkWriteWithOptionsAndForget

        public MongoClient bulkWriteWithOptionsAndForget​(String collection,
                                                         List<io.vertx.ext.mongo.BulkOperation> operations,
                                                         io.vertx.ext.mongo.BulkWriteOptions bulkWriteOptions)
        Variant of io.vertx.mutiny.ext.mongo.MongoClient#bulkWriteWithOptions(String,List,BulkWriteOptions) that ignores the result of the operation.

        This method subscribes on the result of io.vertx.mutiny.ext.mongo.MongoClient#bulkWriteWithOptions(String,List,BulkWriteOptions), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from io.vertx.mutiny.ext.mongo.MongoClient#bulkWriteWithOptions(String,List,BulkWriteOptions) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        operations - the operations to execute
        bulkWriteOptions - the write options
        Returns:
        the instance of MongoClient to chain method calls.
      • find

        public io.smallrye.mutiny.Uni<List<io.vertx.core.json.JsonObject>> find​(String collection,
                                                                                io.vertx.core.json.JsonObject query)
        Find matching documents in the specified collection

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - query used to match documents
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • findAndAwait

        public List<io.vertx.core.json.JsonObject> findAndAwait​(String collection,
                                                                io.vertx.core.json.JsonObject query)
        Blocking variant of find(String,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - query used to match documents
        Returns:
        the List instance produced by the operation.
      • findAndForget

        public MongoClient findAndForget​(String collection,
                                         io.vertx.core.json.JsonObject query)
        Variant of find(String,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of find(String,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from find(String,JsonObject) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        query - query used to match documents
        Returns:
        the instance of MongoClient to chain method calls.
      • findBatch

        public ReadStream<io.vertx.core.json.JsonObject> findBatch​(String collection,
                                                                   io.vertx.core.json.JsonObject query)
        Parameters:
        collection - the collection
        query - query used to match documents
        Returns:
        a emitting found documents
      • findWithOptions

        public io.smallrye.mutiny.Uni<List<io.vertx.core.json.JsonObject>> findWithOptions​(String collection,
                                                                                           io.vertx.core.json.JsonObject query,
                                                                                           io.vertx.ext.mongo.FindOptions options)
        Find matching documents in the specified collection, specifying options

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - query used to match documents
        options - options to configure the find
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • findWithOptionsAndAwait

        public List<io.vertx.core.json.JsonObject> findWithOptionsAndAwait​(String collection,
                                                                           io.vertx.core.json.JsonObject query,
                                                                           io.vertx.ext.mongo.FindOptions options)
        Blocking variant of findWithOptions(String,JsonObject,FindOptions).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - query used to match documents
        options - options to configure the find
        Returns:
        the List instance produced by the operation.
      • findBatchWithOptions

        public ReadStream<io.vertx.core.json.JsonObject> findBatchWithOptions​(String collection,
                                                                              io.vertx.core.json.JsonObject query,
                                                                              io.vertx.ext.mongo.FindOptions options)
        Parameters:
        collection - the collection
        query - query used to match documents
        options - options to configure the find
        Returns:
        a emitting found documents
      • findOne

        public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject> findOne​(String collection,
                                                                             io.vertx.core.json.JsonObject query,
                                                                             io.vertx.core.json.JsonObject fields)
        Find a single matching document in the specified collection

        This operation might change _id field of query parameter

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - the query used to match the document
        fields - the fields
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • findOneAndAwait

        public io.vertx.core.json.JsonObject findOneAndAwait​(String collection,
                                                             io.vertx.core.json.JsonObject query,
                                                             io.vertx.core.json.JsonObject fields)
        Blocking variant of findOne(String,JsonObject,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - the query used to match the document
        fields - the fields
        Returns:
        the JsonObject instance produced by the operation.
      • findOneAndForget

        public MongoClient findOneAndForget​(String collection,
                                            io.vertx.core.json.JsonObject query,
                                            io.vertx.core.json.JsonObject fields)
        Variant of findOne(String,JsonObject,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of findOne(String,JsonObject,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from findOne(String,JsonObject,JsonObject) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        query - the query used to match the document
        fields - the fields
        Returns:
        the instance of MongoClient to chain method calls.
      • findOneAndUpdate

        public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject> findOneAndUpdate​(String collection,
                                                                                      io.vertx.core.json.JsonObject query,
                                                                                      io.vertx.core.json.JsonObject update)
        Find a single matching document in the specified collection and update it.

        This operation might change _id field of query parameter

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - the query used to match the document
        update - used to describe how the documents will be updated
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • findOneAndUpdateAndAwait

        public io.vertx.core.json.JsonObject findOneAndUpdateAndAwait​(String collection,
                                                                      io.vertx.core.json.JsonObject query,
                                                                      io.vertx.core.json.JsonObject update)
        Blocking variant of findOneAndUpdate(String,JsonObject,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - the query used to match the document
        update - used to describe how the documents will be updated
        Returns:
        the JsonObject instance produced by the operation.
      • findOneAndUpdateAndForget

        public MongoClient findOneAndUpdateAndForget​(String collection,
                                                     io.vertx.core.json.JsonObject query,
                                                     io.vertx.core.json.JsonObject update)
        Variant of findOneAndUpdate(String,JsonObject,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of findOneAndUpdate(String,JsonObject,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from findOneAndUpdate(String,JsonObject,JsonObject) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        query - the query used to match the document
        update - used to describe how the documents will be updated
        Returns:
        the instance of MongoClient to chain method calls.
      • findOneAndUpdateWithOptions

        public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject> findOneAndUpdateWithOptions​(String collection,
                                                                                                 io.vertx.core.json.JsonObject query,
                                                                                                 io.vertx.core.json.JsonObject update,
                                                                                                 io.vertx.ext.mongo.FindOptions findOptions,
                                                                                                 io.vertx.ext.mongo.UpdateOptions updateOptions)
        Find a single matching document in the specified collection and update it.

        This operation might change _id field of query parameter

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        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
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • findOneAndUpdateWithOptionsAndAwait

        public io.vertx.core.json.JsonObject findOneAndUpdateWithOptionsAndAwait​(String collection,
                                                                                 io.vertx.core.json.JsonObject query,
                                                                                 io.vertx.core.json.JsonObject update,
                                                                                 io.vertx.ext.mongo.FindOptions findOptions,
                                                                                 io.vertx.ext.mongo.UpdateOptions updateOptions)
        Blocking variant of findOneAndUpdateWithOptions(String,JsonObject,JsonObject,FindOptions,UpdateOptions).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        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
        Returns:
        the JsonObject instance produced by the operation.
      • findOneAndReplace

        public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject> findOneAndReplace​(String collection,
                                                                                       io.vertx.core.json.JsonObject query,
                                                                                       io.vertx.core.json.JsonObject replace)
        Find a single matching document in the specified collection and replace it.

        This operation might change _id field of query parameter

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - the query used to match the document
        replace - the replacement document
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • findOneAndReplaceAndAwait

        public io.vertx.core.json.JsonObject findOneAndReplaceAndAwait​(String collection,
                                                                       io.vertx.core.json.JsonObject query,
                                                                       io.vertx.core.json.JsonObject replace)
        Blocking variant of findOneAndReplace(String,JsonObject,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - the query used to match the document
        replace - the replacement document
        Returns:
        the JsonObject instance produced by the operation.
      • findOneAndReplaceWithOptions

        public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject> findOneAndReplaceWithOptions​(String collection,
                                                                                                  io.vertx.core.json.JsonObject query,
                                                                                                  io.vertx.core.json.JsonObject replace,
                                                                                                  io.vertx.ext.mongo.FindOptions findOptions,
                                                                                                  io.vertx.ext.mongo.UpdateOptions updateOptions)
        Find a single matching document in the specified collection and replace it.

        This operation might change _id field of query parameter

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        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
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • findOneAndReplaceWithOptionsAndAwait

        public io.vertx.core.json.JsonObject findOneAndReplaceWithOptionsAndAwait​(String collection,
                                                                                  io.vertx.core.json.JsonObject query,
                                                                                  io.vertx.core.json.JsonObject replace,
                                                                                  io.vertx.ext.mongo.FindOptions findOptions,
                                                                                  io.vertx.ext.mongo.UpdateOptions updateOptions)
        Blocking variant of findOneAndReplaceWithOptions(String,JsonObject,JsonObject,FindOptions,UpdateOptions).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        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
        Returns:
        the JsonObject instance produced by the operation.
      • findOneAndDelete

        public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject> findOneAndDelete​(String collection,
                                                                                      io.vertx.core.json.JsonObject query)
        Find a single matching document in the specified collection and delete it.

        This operation might change _id field of query parameter

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - the query used to match the document
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • findOneAndDeleteAndAwait

        public io.vertx.core.json.JsonObject findOneAndDeleteAndAwait​(String collection,
                                                                      io.vertx.core.json.JsonObject query)
        Blocking variant of findOneAndDelete(String,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - the query used to match the document
        Returns:
        the JsonObject instance produced by the operation.
      • findOneAndDeleteAndForget

        public MongoClient findOneAndDeleteAndForget​(String collection,
                                                     io.vertx.core.json.JsonObject query)
        Variant of findOneAndDelete(String,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of findOneAndDelete(String,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from findOneAndDelete(String,JsonObject) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        query - the query used to match the document
        Returns:
        the instance of MongoClient to chain method calls.
      • findOneAndDeleteWithOptions

        public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject> findOneAndDeleteWithOptions​(String collection,
                                                                                                 io.vertx.core.json.JsonObject query,
                                                                                                 io.vertx.ext.mongo.FindOptions findOptions)
        Find a single matching document in the specified collection and delete it.

        This operation might change _id field of query parameter

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - the query used to match the document
        findOptions - options to configure the find
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • findOneAndDeleteWithOptionsAndAwait

        public io.vertx.core.json.JsonObject findOneAndDeleteWithOptionsAndAwait​(String collection,
                                                                                 io.vertx.core.json.JsonObject query,
                                                                                 io.vertx.ext.mongo.FindOptions findOptions)
        Blocking variant of findOneAndDeleteWithOptions(String,JsonObject,FindOptions).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - the query used to match the document
        findOptions - options to configure the find
        Returns:
        the JsonObject instance produced by the operation.
      • count

        public io.smallrye.mutiny.Uni<Long> count​(String collection,
                                                  io.vertx.core.json.JsonObject query)
        Count matching documents in a collection.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - query used to match documents
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • countAndAwait

        public Long countAndAwait​(String collection,
                                  io.vertx.core.json.JsonObject query)
        Blocking variant of count(String,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - query used to match documents
        Returns:
        the Long instance produced by the operation.
      • countAndForget

        public MongoClient countAndForget​(String collection,
                                          io.vertx.core.json.JsonObject query)
        Variant of count(String,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of count(String,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from count(String,JsonObject) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        query - query used to match documents
        Returns:
        the instance of MongoClient to chain method calls.
      • removeDocuments

        public io.smallrye.mutiny.Uni<io.vertx.ext.mongo.MongoClientDeleteResult> removeDocuments​(String collection,
                                                                                                  io.vertx.core.json.JsonObject query)
        Remove matching documents from a collection and return the handler with MongoClientDeleteResult result

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - query used to match documents
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • removeDocumentsAndAwait

        public io.vertx.ext.mongo.MongoClientDeleteResult removeDocumentsAndAwait​(String collection,
                                                                                  io.vertx.core.json.JsonObject query)
        Blocking variant of removeDocuments(String,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - query used to match documents
        Returns:
        the MongoClientDeleteResult instance produced by the operation.
      • removeDocumentsAndForget

        public MongoClient removeDocumentsAndForget​(String collection,
                                                    io.vertx.core.json.JsonObject query)
        Variant of removeDocuments(String,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of removeDocuments(String,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from removeDocuments(String,JsonObject) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        query - query used to match documents
        Returns:
        the instance of MongoClient to chain method calls.
      • removeDocumentsWithOptions

        public io.smallrye.mutiny.Uni<io.vertx.ext.mongo.MongoClientDeleteResult> removeDocumentsWithOptions​(String collection,
                                                                                                             io.vertx.core.json.JsonObject query,
                                                                                                             io.vertx.ext.mongo.WriteOption writeOption)
        Remove matching documents from a collection with the specified write option and return the handler with MongoClientDeleteResult result

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - query used to match documents
        writeOption - the write option to use
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • removeDocumentsWithOptionsAndAwait

        public io.vertx.ext.mongo.MongoClientDeleteResult removeDocumentsWithOptionsAndAwait​(String collection,
                                                                                             io.vertx.core.json.JsonObject query,
                                                                                             io.vertx.ext.mongo.WriteOption writeOption)
        Blocking variant of removeDocumentsWithOptions(String,JsonObject,WriteOption).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - query used to match documents
        writeOption - the write option to use
        Returns:
        the MongoClientDeleteResult instance produced by the operation.
      • removeDocument

        public io.smallrye.mutiny.Uni<io.vertx.ext.mongo.MongoClientDeleteResult> removeDocument​(String collection,
                                                                                                 io.vertx.core.json.JsonObject query)
        Remove a single matching document from a collection and return the handler with MongoClientDeleteResult result

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - query used to match document
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • removeDocumentAndAwait

        public io.vertx.ext.mongo.MongoClientDeleteResult removeDocumentAndAwait​(String collection,
                                                                                 io.vertx.core.json.JsonObject query)
        Blocking variant of removeDocument(String,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - query used to match document
        Returns:
        the MongoClientDeleteResult instance produced by the operation.
      • removeDocumentAndForget

        public MongoClient removeDocumentAndForget​(String collection,
                                                   io.vertx.core.json.JsonObject query)
        Variant of removeDocument(String,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of removeDocument(String,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from removeDocument(String,JsonObject) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        query - query used to match document
        Returns:
        the instance of MongoClient to chain method calls.
      • removeDocumentWithOptions

        public io.smallrye.mutiny.Uni<io.vertx.ext.mongo.MongoClientDeleteResult> removeDocumentWithOptions​(String collection,
                                                                                                            io.vertx.core.json.JsonObject query,
                                                                                                            io.vertx.ext.mongo.WriteOption writeOption)
        Remove a single matching document from a collection with the specified write option and return the handler with MongoClientDeleteResult result

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        query - query used to match document
        writeOption - the write option to use
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • removeDocumentWithOptionsAndAwait

        public io.vertx.ext.mongo.MongoClientDeleteResult removeDocumentWithOptionsAndAwait​(String collection,
                                                                                            io.vertx.core.json.JsonObject query,
                                                                                            io.vertx.ext.mongo.WriteOption writeOption)
        Blocking variant of removeDocumentWithOptions(String,JsonObject,WriteOption).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        query - query used to match document
        writeOption - the write option to use
        Returns:
        the MongoClientDeleteResult instance produced by the operation.
      • createCollection

        public io.smallrye.mutiny.Uni<Void> createCollection​(String collectionName)
        Create a new collection

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collectionName - the name of the collection
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • createCollectionAndAwait

        public Void createCollectionAndAwait​(String collectionName)
        Blocking variant of createCollection(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collectionName - the name of the collection
        Returns:
        the Void instance produced by the operation.
      • createCollectionAndForget

        public MongoClient createCollectionAndForget​(String collectionName)
        Variant of createCollection(String) that ignores the result of the operation.

        This method subscribes on the result of createCollection(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from createCollection(String) but you don't need to compose it with other operations.

        Parameters:
        collectionName - the name of the collection
        Returns:
        the instance of MongoClient to chain method calls.
      • getCollections

        public io.smallrye.mutiny.Uni<List<String>> getCollections()
        Get a list of all collections in the database.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • getCollectionsAndAwait

        public List<String> getCollectionsAndAwait()
        Blocking variant of getCollections().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the List instance produced by the operation.
      • getCollectionsAndForget

        public MongoClient getCollectionsAndForget()
        Variant of getCollections() that ignores the result of the operation.

        This method subscribes on the result of getCollections(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from getCollections() but you don't need to compose it with other operations.

        Returns:
        the instance of MongoClient to chain method calls.
      • dropCollection

        public io.smallrye.mutiny.Uni<Void> dropCollection​(String collection)
        Drop a collection

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • dropCollectionAndAwait

        public Void dropCollectionAndAwait​(String collection)
        Blocking variant of dropCollection(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        Returns:
        the Void instance produced by the operation.
      • dropCollectionAndForget

        public MongoClient dropCollectionAndForget​(String collection)
        Variant of dropCollection(String) that ignores the result of the operation.

        This method subscribes on the result of dropCollection(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from dropCollection(String) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        Returns:
        the instance of MongoClient to chain method calls.
      • createIndex

        public io.smallrye.mutiny.Uni<Void> createIndex​(String collection,
                                                        io.vertx.core.json.JsonObject key)
        Creates an index.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        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.
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • createIndexAndAwait

        public Void createIndexAndAwait​(String collection,
                                        io.vertx.core.json.JsonObject key)
        Blocking variant of createIndex(String,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        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.
        Returns:
        the Void instance produced by the operation.
      • createIndexAndForget

        public MongoClient createIndexAndForget​(String collection,
                                                io.vertx.core.json.JsonObject key)
        Variant of createIndex(String,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of createIndex(String,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from createIndex(String,JsonObject) but you don't need to compose it with other operations.

        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.
        Returns:
        the instance of MongoClient to chain method calls.
      • createIndexWithOptions

        public io.smallrye.mutiny.Uni<Void> createIndexWithOptions​(String collection,
                                                                   io.vertx.core.json.JsonObject key,
                                                                   io.vertx.ext.mongo.IndexOptions options)
        Creates an index.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        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
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • createIndexWithOptionsAndAwait

        public Void createIndexWithOptionsAndAwait​(String collection,
                                                   io.vertx.core.json.JsonObject key,
                                                   io.vertx.ext.mongo.IndexOptions options)
        Blocking variant of createIndexWithOptions(String,JsonObject,IndexOptions).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        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
        Returns:
        the Void instance produced by the operation.
      • createIndexWithOptionsAndForget

        public MongoClient createIndexWithOptionsAndForget​(String collection,
                                                           io.vertx.core.json.JsonObject key,
                                                           io.vertx.ext.mongo.IndexOptions options)
        Variant of createIndexWithOptions(String,JsonObject,IndexOptions) that ignores the result of the operation.

        This method subscribes on the result of createIndexWithOptions(String,JsonObject,IndexOptions), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from createIndexWithOptions(String,JsonObject,IndexOptions) but you don't need to compose it with other operations.

        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
        Returns:
        the instance of MongoClient to chain method calls.
      • createIndexes

        public io.smallrye.mutiny.Uni<Void> createIndexes​(String collection,
                                                          List<io.vertx.ext.mongo.IndexModel> indexes)
        creates an indexes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        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.
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • createIndexesAndAwait

        public Void createIndexesAndAwait​(String collection,
                                          List<io.vertx.ext.mongo.IndexModel> indexes)
        Blocking variant of io.vertx.mutiny.ext.mongo.MongoClient#createIndexes(String,List).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        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.
        Returns:
        the Void instance produced by the operation.
      • createIndexesAndForget

        public MongoClient createIndexesAndForget​(String collection,
                                                  List<io.vertx.ext.mongo.IndexModel> indexes)
        Variant of io.vertx.mutiny.ext.mongo.MongoClient#createIndexes(String,List) that ignores the result of the operation.

        This method subscribes on the result of io.vertx.mutiny.ext.mongo.MongoClient#createIndexes(String,List), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from io.vertx.mutiny.ext.mongo.MongoClient#createIndexes(String,List) but you don't need to compose it with other operations.

        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.
        Returns:
        the instance of MongoClient to chain method calls.
      • listIndexes

        public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonArray> listIndexes​(String collection)
        Get all the indexes in this collection.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • listIndexesAndAwait

        public io.vertx.core.json.JsonArray listIndexesAndAwait​(String collection)
        Blocking variant of listIndexes(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        Returns:
        the JsonArray instance produced by the operation.
      • listIndexesAndForget

        public MongoClient listIndexesAndForget​(String collection)
        Variant of listIndexes(String) that ignores the result of the operation.

        This method subscribes on the result of listIndexes(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from listIndexes(String) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        Returns:
        the instance of MongoClient to chain method calls.
      • dropIndex

        public io.smallrye.mutiny.Uni<Void> dropIndex​(String collection,
                                                      String indexName)
        Drops the index given its name.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        indexName - the name of the index to remove
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • dropIndexAndAwait

        public Void dropIndexAndAwait​(String collection,
                                      String indexName)
        Blocking variant of dropIndex(String,String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        indexName - the name of the index to remove
        Returns:
        the Void instance produced by the operation.
      • dropIndexAndForget

        public MongoClient dropIndexAndForget​(String collection,
                                              String indexName)
        Variant of dropIndex(String,String) that ignores the result of the operation.

        This method subscribes on the result of dropIndex(String,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from dropIndex(String,String) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        indexName - the name of the index to remove
        Returns:
        the instance of MongoClient to chain method calls.
      • runCommand

        public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject> runCommand​(String commandName,
                                                                                io.vertx.core.json.JsonObject command)
        Run an arbitrary MongoDB command.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        commandName - the name of the command
        command - the command
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • runCommandAndAwait

        public io.vertx.core.json.JsonObject runCommandAndAwait​(String commandName,
                                                                io.vertx.core.json.JsonObject command)
        Blocking variant of runCommand(String,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        commandName - the name of the command
        command - the command
        Returns:
        the JsonObject instance produced by the operation.
      • runCommandAndForget

        public MongoClient runCommandAndForget​(String commandName,
                                               io.vertx.core.json.JsonObject command)
        Variant of runCommand(String,JsonObject) that ignores the result of the operation.

        This method subscribes on the result of runCommand(String,JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from runCommand(String,JsonObject) but you don't need to compose it with other operations.

        Parameters:
        commandName - the name of the command
        command - the command
        Returns:
        the instance of MongoClient to chain method calls.
      • distinct

        public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonArray> distinct​(String collection,
                                                                             String fieldName,
                                                                             String resultClassname)
        Gets the distinct values of the specified field name. Return a JsonArray containing distinct values (eg: [ 1 , 89 ])

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        fieldName - the field name
        resultClassname -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • distinctAndAwait

        public io.vertx.core.json.JsonArray distinctAndAwait​(String collection,
                                                             String fieldName,
                                                             String resultClassname)
        Blocking variant of distinct(String,String,String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        fieldName - the field name
        resultClassname -
        Returns:
        the JsonArray instance produced by the operation.
      • distinctAndForget

        public MongoClient distinctAndForget​(String collection,
                                             String fieldName,
                                             String resultClassname)
        Variant of distinct(String,String,String) that ignores the result of the operation.

        This method subscribes on the result of distinct(String,String,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from distinct(String,String,String) but you don't need to compose it with other operations.

        Parameters:
        collection - the collection
        fieldName - the field name
        resultClassname -
        Returns:
        the instance of MongoClient to chain method calls.
      • distinctWithQuery

        public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonArray> distinctWithQuery​(String collection,
                                                                                      String fieldName,
                                                                                      String resultClassname,
                                                                                      io.vertx.core.json.JsonObject query)
        Gets the distinct values of the specified field name filtered by specified query. Return a JsonArray containing distinct values (eg: [ 1 , 89 ])

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        collection - the collection
        fieldName - the field name
        resultClassname -
        query - the query
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • distinctWithQueryAndAwait

        public io.vertx.core.json.JsonArray distinctWithQueryAndAwait​(String collection,
                                                                      String fieldName,
                                                                      String resultClassname,
                                                                      io.vertx.core.json.JsonObject query)
        Blocking variant of distinctWithQuery(String,String,String,JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        collection - the collection
        fieldName - the field name
        resultClassname -
        query - the query
        Returns:
        the JsonArray instance produced by the operation.
      • distinctBatch

        public ReadStream<io.vertx.core.json.JsonObject> distinctBatch​(String collection,
                                                                       String fieldName,
                                                                       String resultClassname)
        Parameters:
        collection - the collection
        fieldName - the field name
        resultClassname -
        Returns:
        a emitting json fragments
      • distinctBatchWithQuery

        public ReadStream<io.vertx.core.json.JsonObject> distinctBatchWithQuery​(String collection,
                                                                                String fieldName,
                                                                                String resultClassname,
                                                                                io.vertx.core.json.JsonObject query)
        Parameters:
        collection - the collection
        fieldName - the field name
        resultClassname -
        query - the query
        Returns:
        a emitting json fragments
      • distinctBatchWithQuery

        public ReadStream<io.vertx.core.json.JsonObject> distinctBatchWithQuery​(String collection,
                                                                                String fieldName,
                                                                                String resultClassname,
                                                                                io.vertx.core.json.JsonObject query,
                                                                                int batchSize)
        Parameters:
        collection - the collection
        fieldName - the field name
        resultClassname -
        query - the query
        batchSize - the number of documents to load in a batch
        Returns:
        a emitting json fragments
      • aggregate

        public ReadStream<io.vertx.core.json.JsonObject> aggregate​(String collection,
                                                                   io.vertx.core.json.JsonArray pipeline)
        Parameters:
        collection - the collection
        pipeline - aggregation pipeline to be executed
        Returns:
      • aggregateWithOptions

        public ReadStream<io.vertx.core.json.JsonObject> aggregateWithOptions​(String collection,
                                                                              io.vertx.core.json.JsonArray pipeline,
                                                                              io.vertx.ext.mongo.AggregateOptions options)
        Parameters:
        collection - the collection
        pipeline - aggregation pipeline to be executed
        options - options to configure the aggregation command
        Returns:
      • createDefaultGridFsBucketService

        public io.smallrye.mutiny.Uni<MongoGridFsClient> createDefaultGridFsBucketService()
        Creates a MongoGridFsClient used to interact with Mongo GridFS.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • createDefaultGridFsBucketServiceAndAwait

        public MongoGridFsClient createDefaultGridFsBucketServiceAndAwait()
        Blocking variant of createDefaultGridFsBucketService().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the MongoGridFsClient instance produced by the operation.
      • createGridFsBucketService

        public io.smallrye.mutiny.Uni<MongoGridFsClient> createGridFsBucketService​(String bucketName)
        Creates a MongoGridFsClient used to interact with Mongo GridFS.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        bucketName - the name of the GridFS bucket
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • createGridFsBucketServiceAndAwait

        public MongoGridFsClient createGridFsBucketServiceAndAwait​(String bucketName)
        Blocking variant of createGridFsBucketService(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        bucketName - the name of the GridFS bucket
        Returns:
        the MongoGridFsClient instance produced by the operation.
      • createGridFsBucketServiceAndForget

        public MongoClient createGridFsBucketServiceAndForget​(String bucketName)
        Variant of createGridFsBucketService(String) that ignores the result of the operation.

        This method subscribes on the result of createGridFsBucketService(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from createGridFsBucketService(String) but you don't need to compose it with other operations.

        Parameters:
        bucketName - the name of the GridFS bucket
        Returns:
        the instance of MongoClient to chain method calls.
      • close

        public io.smallrye.mutiny.Uni<Void> close()
        Close the client and release its resources

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • closeAndAwait

        public Void closeAndAwait()
        Blocking variant of close().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the Void instance produced by the operation.
      • closeAndForget

        public void closeAndForget()
        Variant of close() that ignores the result of the operation.

        This method subscribes on the result of close(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from close() but you don't need to compose it with other operations.

      • watch

        public ReadStream<com.mongodb.client.model.changestream.ChangeStreamDocument<io.vertx.core.json.JsonObject>> watch​(String collection,
                                                                                                                           io.vertx.core.json.JsonArray pipeline,
                                                                                                                           boolean withUpdatedDoc,
                                                                                                                           int batchSize)
        Parameters:
        collection - the collection
        pipeline - watching pipeline to be executed
        withUpdatedDoc - whether to get updated fullDocument for "update" operation
        batchSize - the number of documents to load in a batch
        Returns:
      • newInstance

        public static MongoClient newInstance​(io.vertx.ext.mongo.MongoClient arg)