Interface MongoCollection<TDocument>


  • public interface MongoCollection<TDocument>
    The MongoCollection interface.

    Note: Additions to this interface will not be considered to break binary compatibility.

    Since:
    1.0
    • Method Detail

      • getNamespace

        MongoNamespace getNamespace()
        Gets the namespace of this collection.
        Returns:
        the namespace
      • getDocumentClass

        java.lang.Class<TDocument> getDocumentClass()
        Get the class of documents stored in this collection.
        Returns:
        the class
      • getWriteConcern

        WriteConcern getWriteConcern()
        Get the write concern for the MongoCollection.
        Returns:
        the WriteConcern
      • getReadConcern

        ReadConcern getReadConcern()
        Get the read concern for the MongoCollection.
        Returns:
        the ReadConcern
        Since:
        1.2
        Since server release
        3.2
      • withDocumentClass

        <NewTDocument> MongoCollection<NewTDocument> withDocumentClass​(java.lang.Class<NewTDocument> clazz)
        Create a new MongoCollection instance with a different default class to cast any documents returned from the database into..
        Type Parameters:
        NewTDocument - The type that the new collection will encode documents from and decode documents to
        Parameters:
        clazz - the default class to cast any documents returned from the database into.
        Returns:
        a new MongoCollection instance with the different default class
      • withCodecRegistry

        MongoCollection<TDocument> withCodecRegistry​(CodecRegistry codecRegistry)
        Create a new MongoCollection instance with a different codec registry.
        Parameters:
        codecRegistry - the new CodecRegistry for the collection
        Returns:
        a new MongoCollection instance with the different codec registry
      • withReadPreference

        MongoCollection<TDocument> withReadPreference​(ReadPreference readPreference)
        Create a new MongoCollection instance with a different read preference.
        Parameters:
        readPreference - the new ReadPreference for the collection
        Returns:
        a new MongoCollection instance with the different readPreference
      • withWriteConcern

        MongoCollection<TDocument> withWriteConcern​(WriteConcern writeConcern)
        Create a new MongoCollection instance with a different write concern.
        Parameters:
        writeConcern - the new WriteConcern for the collection
        Returns:
        a new MongoCollection instance with the different writeConcern
      • withReadConcern

        MongoCollection<TDocument> withReadConcern​(ReadConcern readConcern)
        Create a new MongoCollection instance with a different read concern.
        Parameters:
        readConcern - the new ReadConcern for the collection
        Returns:
        a new MongoCollection instance with the different ReadConcern
        Since:
        1.2
        Since server release
        3.2
      • estimatedDocumentCount

        Future<java.lang.Long> estimatedDocumentCount()
        Gets an estimate of the count of documents in a collection using collection metadata.
        Returns:
        a future with a single element indicating the estimated number of documents
        Since:
        1.9
      • estimatedDocumentCount

        void estimatedDocumentCount​(Handler<AsyncResult<java.lang.Long>> resultHandler)
        Gets an estimate of the count of documents in a collection using collection metadata.
        Parameters:
        resultHandler - an async result with a single element indicating the estimated number of documents
        Since:
        1.9
      • estimatedDocumentCount

        Future<java.lang.Long> estimatedDocumentCount​(EstimatedDocumentCountOptions options)
        Gets an estimate of the count of documents in a collection using collection metadata.
        Parameters:
        options - the options describing the count
        Returns:
        a future with a single element indicating the estimated number of documents
        Since:
        1.9
      • estimatedDocumentCount

        void estimatedDocumentCount​(EstimatedDocumentCountOptions options,
                                    Handler<AsyncResult<java.lang.Long>> resultHandler)
        Gets an estimate of the count of documents in a collection using collection metadata.
        Parameters:
        options - the options describing the count
        resultHandler - an async result with a single element indicating the estimated number of documents
        Since:
        1.9
      • countDocuments

        Future<java.lang.Long> countDocuments()
        Counts the number of documents in the collection.

        Note: For a fast count of the total documents in a collection see estimatedDocumentCount().
        Note: When migrating from count() to countDocuments() the following query operators must be replaced:

           +-------------+--------------------------------+
           | Operator    | Replacement                    |
           +=============+================================+
           | $where      |  $expr                         |
           +-------------+--------------------------------+
           | $near       |  $geoWithin with $center       |
           +-------------+--------------------------------+
           | $nearSphere |  $geoWithin with $centerSphere |
           +-------------+--------------------------------+
          
        Returns:
        a future with a single element indicating the number of documents
        Since:
        1.9
      • countDocuments

        void countDocuments​(Handler<AsyncResult<java.lang.Long>> resultHandler)
        Counts the number of documents in the collection.

        Note: For a fast count of the total documents in a collection see estimatedDocumentCount().
        Note: When migrating from count() to countDocuments() the following query operators must be replaced:

           +-------------+--------------------------------+
           | Operator    | Replacement                    |
           +=============+================================+
           | $where      |  $expr                         |
           +-------------+--------------------------------+
           | $near       |  $geoWithin with $center       |
           +-------------+--------------------------------+
           | $nearSphere |  $geoWithin with $centerSphere |
           +-------------+--------------------------------+
          
        Parameters:
        resultHandler - an async result with a single element indicating the number of documents
        Since:
        1.9
      • countDocuments

        Future<java.lang.Long> countDocuments​(JsonObject filter)
        Counts the number of documents in the collection according to the given options.

        Note: For a fast count of the total documents in a collection see estimatedDocumentCount().
        Note: When migrating from count() to countDocuments() the following query operators must be replaced:

           +-------------+--------------------------------+
           | Operator    | Replacement                    |
           +=============+================================+
           | $where      |  $expr                         |
           +-------------+--------------------------------+
           | $near       |  $geoWithin with $center       |
           +-------------+--------------------------------+
           | $nearSphere |  $geoWithin with $centerSphere |
           +-------------+--------------------------------+
          
        Parameters:
        filter - the query filter
        Returns:
        a future with a single element indicating the number of documents
        Since:
        1.9
      • countDocuments

        void countDocuments​(JsonObject filter,
                            Handler<AsyncResult<java.lang.Long>> resultHandler)
        Counts the number of documents in the collection according to the given options.

        Note: For a fast count of the total documents in a collection see estimatedDocumentCount().
        Note: When migrating from count() to countDocuments() the following query operators must be replaced:

           +-------------+--------------------------------+
           | Operator    | Replacement                    |
           +=============+================================+
           | $where      |  $expr                         |
           +-------------+--------------------------------+
           | $near       |  $geoWithin with $center       |
           +-------------+--------------------------------+
           | $nearSphere |  $geoWithin with $centerSphere |
           +-------------+--------------------------------+
          
        Parameters:
        filter - the query filter
        resultHandler - an async result with a single element indicating the number of documents
        Since:
        1.9
      • countDocuments

        Future<java.lang.Long> countDocuments​(JsonObject filter,
                                              CountOptions options)
        Counts the number of documents in the collection according to the given options.

        Note: For a fast count of the total documents in a collection see estimatedDocumentCount().
        Note: When migrating from count() to countDocuments() the following query operators must be replaced:

           +-------------+--------------------------------+
           | Operator    | Replacement                    |
           +=============+================================+
           | $where      |  $expr                         |
           +-------------+--------------------------------+
           | $near       |  $geoWithin with $center       |
           +-------------+--------------------------------+
           | $nearSphere |  $geoWithin with $centerSphere |
           +-------------+--------------------------------+
          
        Parameters:
        filter - the query filter
        options - the options describing the count
        Returns:
        a future with a single element indicating the number of documents
        Since:
        1.9
      • countDocuments

        void countDocuments​(JsonObject filter,
                            CountOptions options,
                            Handler<AsyncResult<java.lang.Long>> resultHandler)
        Counts the number of documents in the collection according to the given options.

        Note: For a fast count of the total documents in a collection see estimatedDocumentCount().
        Note: When migrating from count() to countDocuments() the following query operators must be replaced:

           +-------------+--------------------------------+
           | Operator    | Replacement                    |
           +=============+================================+
           | $where      |  $expr                         |
           +-------------+--------------------------------+
           | $near       |  $geoWithin with $center       |
           +-------------+--------------------------------+
           | $nearSphere |  $geoWithin with $centerSphere |
           +-------------+--------------------------------+
          
        Parameters:
        filter - the query filter
        options - the options describing the count
        resultHandler - an async result with a single element indicating the number of documents
        Since:
        1.9
      • countDocuments

        Future<java.lang.Long> countDocuments​(ClientSession clientSession)
        Counts the number of documents in the collection.

        Note: For a fast count of the total documents in a collection see estimatedDocumentCount().
        Note: When migrating from count() to countDocuments() the following query operators must be replaced:

           +-------------+--------------------------------+
           | Operator    | Replacement                    |
           +=============+================================+
           | $where      |  $expr                         |
           +-------------+--------------------------------+
           | $near       |  $geoWithin with $center       |
           +-------------+--------------------------------+
           | $nearSphere |  $geoWithin with $centerSphere |
           +-------------+--------------------------------+
          
        Parameters:
        clientSession - the client session with which to associate this operation
        Returns:
        a future with a single element indicating the number of documents
        Since:
        1.9
        Since server release
        3.6
      • countDocuments

        void countDocuments​(ClientSession clientSession,
                            Handler<AsyncResult<java.lang.Long>> resultHandler)
        Counts the number of documents in the collection.

        Note: For a fast count of the total documents in a collection see estimatedDocumentCount().
        Note: When migrating from count() to countDocuments() the following query operators must be replaced:

           +-------------+--------------------------------+
           | Operator    | Replacement                    |
           +=============+================================+
           | $where      |  $expr                         |
           +-------------+--------------------------------+
           | $near       |  $geoWithin with $center       |
           +-------------+--------------------------------+
           | $nearSphere |  $geoWithin with $centerSphere |
           +-------------+--------------------------------+
          
        Parameters:
        clientSession - the client session with which to associate this operation
        resultHandler - an async result with a single element indicating the number of documents
        Since:
        1.9
        Since server release
        3.6
      • countDocuments

        Future<java.lang.Long> countDocuments​(ClientSession clientSession,
                                              JsonObject filter)
        Counts the number of documents in the collection according to the given options.

        Note: For a fast count of the total documents in a collection see estimatedDocumentCount().

        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter
        Returns:
        a future with a single element indicating the number of documents
        Since:
        1.9
        Since server release
        3.6
      • countDocuments

        void countDocuments​(ClientSession clientSession,
                            JsonObject filter,
                            Handler<AsyncResult<java.lang.Long>> resultHandler)
        Counts the number of documents in the collection according to the given options.

        Note: For a fast count of the total documents in a collection see estimatedDocumentCount().

        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter
        resultHandler - an async result with a single element indicating the number of documents
        Since:
        1.9
        Since server release
        3.6
      • countDocuments

        Future<java.lang.Long> countDocuments​(ClientSession clientSession,
                                              JsonObject filter,
                                              CountOptions options)
        Counts the number of documents in the collection according to the given options.

        Note: For a fast count of the total documents in a collection see estimatedDocumentCount().
        Note: When migrating from count() to countDocuments() the following query operators must be replaced:

           +-------------+--------------------------------+
           | Operator    | Replacement                    |
           +=============+================================+
           | $where      |  $expr                         |
           +-------------+--------------------------------+
           | $near       |  $geoWithin with $center       |
           +-------------+--------------------------------+
           | $nearSphere |  $geoWithin with $centerSphere |
           +-------------+--------------------------------+
          
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter
        options - the options describing the count
        Returns:
        a future with a single element indicating the number of documents
        Since:
        1.9
        Since server release
        3.6
      • countDocuments

        void countDocuments​(ClientSession clientSession,
                            JsonObject filter,
                            CountOptions options,
                            Handler<AsyncResult<java.lang.Long>> resultHandler)
        Counts the number of documents in the collection according to the given options.

        Note: For a fast count of the total documents in a collection see estimatedDocumentCount().
        Note: When migrating from count() to countDocuments() the following query operators must be replaced:

           +-------------+--------------------------------+
           | Operator    | Replacement                    |
           +=============+================================+
           | $where      |  $expr                         |
           +-------------+--------------------------------+
           | $near       |  $geoWithin with $center       |
           +-------------+--------------------------------+
           | $nearSphere |  $geoWithin with $centerSphere |
           +-------------+--------------------------------+
          
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter
        options - the options describing the count
        resultHandler - an async result with a single element indicating the number of documents
        Since:
        1.9
        Since server release
        3.6
      • find

        MongoResult<TDocument> find()
        Finds all documents in the collection.
        Returns:
        the fluent find interface
        MongoDB documentation
        Find
      • find

        MongoResult<TDocument> find​(FindOptions options)
        Finds all documents in the collection.
        Parameters:
        options - options
        Returns:
        the fluent find interface
        MongoDB documentation
        Find
      • find

        MongoResult<TDocument> find​(JsonObject filter)
        Finds all documents in the collection.
        Parameters:
        filter - the query filter
        Returns:
        the fluent find interface
        MongoDB documentation
        Find
      • find

        MongoResult<TDocument> find​(JsonObject filter,
                                    FindOptions options)
        Finds all documents in the collection.
        Parameters:
        filter - the query filter
        options - options
        Returns:
        the fluent find interface
        MongoDB documentation
        Find
      • find

        MongoResult<TDocument> find​(ClientSession clientSession)
        Finds all documents in the collection.
        Parameters:
        clientSession - the client session with which to associate this operation
        Returns:
        the fluent find interface
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Find
      • find

        MongoResult<TDocument> find​(ClientSession clientSession,
                                    FindOptions options)
        Finds all documents in the collection.
        Parameters:
        clientSession - the client session with which to associate this operation
        options - options
        Returns:
        the fluent find interface
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Find
      • find

        MongoResult<TDocument> find​(ClientSession clientSession,
                                    JsonObject filter)
        Finds all documents in the collection.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter
        Returns:
        the fluent find interface
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Find
      • find

        MongoResult<TDocument> find​(ClientSession clientSession,
                                    JsonObject filter,
                                    FindOptions options)
        Finds all documents in the collection.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter
        options - options
        Returns:
        the fluent find interface
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Find
      • aggregate

        MongoCollectionResult<TDocument> aggregate​(JsonArray pipeline)
        Aggregates documents according to the specified aggregation pipeline.
        Parameters:
        pipeline - the aggregate pipeline
        Returns:
        a result containing the result of the aggregation operation
        MongoDB documentation
        Aggregation
      • aggregate

        MongoCollectionResult<TDocument> aggregate​(JsonArray pipeline,
                                                   AggregateOptions options)
        Aggregates documents according to the specified aggregation pipeline.
        Parameters:
        pipeline - the aggregate pipeline
        options - options
        Returns:
        a result containing the result of the aggregation operation
        MongoDB documentation
        Aggregation
      • aggregate

        MongoCollectionResult<TDocument> aggregate​(ClientSession clientSession,
                                                   JsonArray pipeline)
        Aggregates documents according to the specified aggregation pipeline.
        Parameters:
        clientSession - the client session with which to associate this operation
        pipeline - the aggregate pipeline
        Returns:
        a result containing the result of the aggregation operation
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Aggregation
      • aggregate

        MongoCollectionResult<TDocument> aggregate​(ClientSession clientSession,
                                                   JsonArray pipeline,
                                                   AggregateOptions options)
        Aggregates documents according to the specified aggregation pipeline.
        Parameters:
        clientSession - the client session with which to associate this operation
        pipeline - the aggregate pipeline
        options - options
        Returns:
        a result containing the result of the aggregation operation
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Aggregation
      • watch

        MongoResult<ChangeStreamDocument<JsonObject>> watch​(ClientSession clientSession,
                                                            JsonArray pipeline)
        Creates a change stream for this collection.
        Parameters:
        clientSession - the client session with which to associate this operation
        pipeline - the aggregation pipeline to apply to the change stream
        Returns:
        the change stream read stream
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        $changeStream
      • mapReduce

        MongoCollectionResult<TDocument> mapReduce​(java.lang.String mapFunction,
                                                   java.lang.String reduceFunction)
        Aggregates documents according to the specified map-reduce function.
        Parameters:
        mapFunction - A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.
        reduceFunction - A JavaScript function that "reduces" to a single object all the values associated with a particular key.
        Returns:
        an result containing the result of the map-reduce operation
        MongoDB documentation
        map-reduce
      • mapReduce

        MongoCollectionResult<TDocument> mapReduce​(java.lang.String mapFunction,
                                                   java.lang.String reduceFunction,
                                                   MapReduceOptions options)
        Aggregates documents according to the specified map-reduce function.
        Parameters:
        mapFunction - A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.
        reduceFunction - A JavaScript function that "reduces" to a single object all the values associated with a particular key.
        options - options
        Returns:
        an result containing the result of the map-reduce operation
        MongoDB documentation
        map-reduce
      • mapReduce

        MongoCollectionResult<TDocument> mapReduce​(ClientSession clientSession,
                                                   java.lang.String mapFunction,
                                                   java.lang.String reduceFunction)
        Aggregates documents according to the specified map-reduce function.
        Parameters:
        clientSession - the client session with which to associate this operation
        mapFunction - A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.
        reduceFunction - A JavaScript function that "reduces" to a single object all the values associated with a particular key.
        Returns:
        an result containing the result of the map-reduce operation
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        map-reduce
      • mapReduce

        MongoCollectionResult<TDocument> mapReduce​(ClientSession clientSession,
                                                   java.lang.String mapFunction,
                                                   java.lang.String reduceFunction,
                                                   MapReduceOptions options)
        Aggregates documents according to the specified map-reduce function.
        Parameters:
        clientSession - the client session with which to associate this operation
        mapFunction - A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.
        reduceFunction - A JavaScript function that "reduces" to a single object all the values associated with a particular key.
        options - options
        Returns:
        an result containing the result of the map-reduce operation
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        map-reduce
      • bulkWrite

        Future<BulkWriteResult> bulkWrite​(java.util.List<? extends WriteModel<? extends TDocument>> requests)
        Executes a mix of inserts, updates, replaces, and deletes.
        Parameters:
        requests - the writes to execute
        Returns:
        a future with a single element the BulkWriteResult
      • bulkWrite

        void bulkWrite​(java.util.List<? extends WriteModel<? extends TDocument>> requests,
                       Handler<AsyncResult<BulkWriteResult>> resultHandler)
        Executes a mix of inserts, updates, replaces, and deletes.
        Parameters:
        requests - the writes to execute
        resultHandler - an async result with a single element the BulkWriteResult
      • bulkWrite

        Future<BulkWriteResult> bulkWrite​(java.util.List<? extends WriteModel<? extends TDocument>> requests,
                                          BulkWriteOptions options)
        Executes a mix of inserts, updates, replaces, and deletes.
        Parameters:
        requests - the writes to execute
        options - the options to apply to the bulk write operation
        Returns:
        a future with a single element the BulkWriteResult
      • bulkWrite

        void bulkWrite​(java.util.List<? extends WriteModel<? extends TDocument>> requests,
                       BulkWriteOptions options,
                       Handler<AsyncResult<BulkWriteResult>> resultHandler)
        Executes a mix of inserts, updates, replaces, and deletes.
        Parameters:
        requests - the writes to execute
        options - the options to apply to the bulk write operation
        resultHandler - an async result with a single element the BulkWriteResult
      • bulkWrite

        Future<BulkWriteResult> bulkWrite​(ClientSession clientSession,
                                          java.util.List<? extends WriteModel<? extends TDocument>> requests)
        Executes a mix of inserts, updates, replaces, and deletes.
        Parameters:
        clientSession - the client session with which to associate this operation
        requests - the writes to execute
        Returns:
        a future with a single element the BulkWriteResult
        Since:
        1.7
        Since server release
        3.6
      • bulkWrite

        void bulkWrite​(ClientSession clientSession,
                       java.util.List<? extends WriteModel<? extends TDocument>> requests,
                       Handler<AsyncResult<BulkWriteResult>> resultHandler)
        Executes a mix of inserts, updates, replaces, and deletes.
        Parameters:
        clientSession - the client session with which to associate this operation
        requests - the writes to execute
        resultHandler - an async result with a single element the BulkWriteResult
        Since:
        1.7
        Since server release
        3.6
      • bulkWrite

        Future<BulkWriteResult> bulkWrite​(ClientSession clientSession,
                                          java.util.List<? extends WriteModel<? extends TDocument>> requests,
                                          BulkWriteOptions options)
        Executes a mix of inserts, updates, replaces, and deletes.
        Parameters:
        clientSession - the client session with which to associate this operation
        requests - the writes to execute
        options - the options to apply to the bulk write operation
        Returns:
        a future with a single element the BulkWriteResult
        Since:
        1.7
        Since server release
        3.6
      • bulkWrite

        void bulkWrite​(ClientSession clientSession,
                       java.util.List<? extends WriteModel<? extends TDocument>> requests,
                       BulkWriteOptions options,
                       Handler<AsyncResult<BulkWriteResult>> resultHandler)
        Executes a mix of inserts, updates, replaces, and deletes.
        Parameters:
        clientSession - the client session with which to associate this operation
        requests - the writes to execute
        options - the options to apply to the bulk write operation
        resultHandler - an async result with a single element the BulkWriteResult
        Since:
        1.7
        Since server release
        3.6
      • insertOne

        Future<InsertOneResult> insertOne​(TDocument document)
        Inserts the provided document. If the document is missing an identifier, the driver should generate one.
        Parameters:
        document - the document to insert
        Returns:
        a future with a single element with the InsertOneResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
      • insertOne

        void insertOne​(TDocument document,
                       Handler<AsyncResult<InsertOneResult>> resultHandler)
        Inserts the provided document. If the document is missing an identifier, the driver should generate one.
        Parameters:
        document - the document to insert
        resultHandler - an async result with a single element with the InsertOneResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
      • insertOne

        Future<InsertOneResult> insertOne​(TDocument document,
                                          InsertOneOptions options)
        Inserts the provided document. If the document is missing an identifier, the driver should generate one.
        Parameters:
        document - the document to insert
        options - the options to apply to the operation
        Returns:
        a future with a single element with the InsertOneResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
        Since:
        1.2
      • insertOne

        void insertOne​(TDocument document,
                       InsertOneOptions options,
                       Handler<AsyncResult<InsertOneResult>> resultHandler)
        Inserts the provided document. If the document is missing an identifier, the driver should generate one.
        Parameters:
        document - the document to insert
        options - the options to apply to the operation
        resultHandler - an async result with a single element with the InsertOneResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
        Since:
        1.2
      • insertOne

        Future<InsertOneResult> insertOne​(ClientSession clientSession,
                                          TDocument document)
        Inserts the provided document. If the document is missing an identifier, the driver should generate one.
        Parameters:
        clientSession - the client session with which to associate this operation
        document - the document to insert
        Returns:
        a future with a single element with the InsertOneResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • insertOne

        void insertOne​(ClientSession clientSession,
                       TDocument document,
                       Handler<AsyncResult<InsertOneResult>> resultHandler)
        Inserts the provided document. If the document is missing an identifier, the driver should generate one.
        Parameters:
        clientSession - the client session with which to associate this operation
        document - the document to insert
        resultHandler - an async result with a single element with the InsertOneResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • insertOne

        Future<InsertOneResult> insertOne​(ClientSession clientSession,
                                          TDocument document,
                                          InsertOneOptions options)
        Inserts the provided document. If the document is missing an identifier, the driver should generate one.
        Parameters:
        clientSession - the client session with which to associate this operation
        document - the document to insert
        options - the options to apply to the operation
        Returns:
        a future with a single element with the InsertOneResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • insertOne

        void insertOne​(ClientSession clientSession,
                       TDocument document,
                       InsertOneOptions options,
                       Handler<AsyncResult<InsertOneResult>> resultHandler)
        Inserts the provided document. If the document is missing an identifier, the driver should generate one.
        Parameters:
        clientSession - the client session with which to associate this operation
        document - the document to insert
        options - the options to apply to the operation
        resultHandler - an async result with a single element with the InsertOneResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • insertMany

        Future<InsertManyResult> insertMany​(java.util.List<? extends TDocument> documents)
        Inserts a batch of documents.
        Parameters:
        documents - the documents to insert
        Returns:
        a future with a single element with the InsertManyResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
      • insertMany

        void insertMany​(java.util.List<? extends TDocument> documents,
                        Handler<AsyncResult<InsertManyResult>> resultHandler)
        Inserts a batch of documents.
        Parameters:
        documents - the documents to insert
        resultHandler - an async result with a single element with the InsertManyResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
      • insertMany

        Future<InsertManyResult> insertMany​(java.util.List<? extends TDocument> documents,
                                            InsertManyOptions options)
        Inserts a batch of documents.
        Parameters:
        documents - the documents to insert
        options - the options to apply to the operation
        Returns:
        a future with a single element with the InsertManyResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
      • insertMany

        void insertMany​(java.util.List<? extends TDocument> documents,
                        InsertManyOptions options,
                        Handler<AsyncResult<InsertManyResult>> resultHandler)
        Inserts a batch of documents.
        Parameters:
        documents - the documents to insert
        options - the options to apply to the operation
        resultHandler - an async result with a single element with the InsertManyResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
      • insertMany

        Future<InsertManyResult> insertMany​(ClientSession clientSession,
                                            java.util.List<? extends TDocument> documents)
        Inserts a batch of documents.
        Parameters:
        clientSession - the client session with which to associate this operation
        documents - the documents to insert
        Returns:
        a future with a single element with the InsertManyResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • insertMany

        void insertMany​(ClientSession clientSession,
                        java.util.List<? extends TDocument> documents,
                        Handler<AsyncResult<InsertManyResult>> resultHandler)
        Inserts a batch of documents.
        Parameters:
        clientSession - the client session with which to associate this operation
        documents - the documents to insert
        resultHandler - an async result with a single element with the InsertManyResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • insertMany

        Future<InsertManyResult> insertMany​(ClientSession clientSession,
                                            java.util.List<? extends TDocument> documents,
                                            InsertManyOptions options)
        Inserts a batch of documents.
        Parameters:
        clientSession - the client session with which to associate this operation
        documents - the documents to insert
        options - the options to apply to the operation
        Returns:
        a future with a single element with the InsertManyResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • insertMany

        void insertMany​(ClientSession clientSession,
                        java.util.List<? extends TDocument> documents,
                        InsertManyOptions options,
                        Handler<AsyncResult<InsertManyResult>> resultHandler)
        Inserts a batch of documents.
        Parameters:
        clientSession - the client session with which to associate this operation
        documents - the documents to insert
        options - the options to apply to the operation
        resultHandler - an async result with a single element with the InsertManyResult or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • deleteOne

        Future<DeleteResult> deleteOne​(JsonObject filter)
        Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.
        Parameters:
        filter - the query filter to apply the the delete operation
        Returns:
        a future with a single element the DeleteResult or with an com.mongodb.MongoException
      • deleteOne

        void deleteOne​(JsonObject filter,
                       Handler<AsyncResult<DeleteResult>> resultHandler)
        Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.
        Parameters:
        filter - the query filter to apply the the delete operation
        resultHandler - an async result with a single element the DeleteResult or with an com.mongodb.MongoException
      • deleteOne

        Future<DeleteResult> deleteOne​(JsonObject filter,
                                       DeleteOptions options)
        Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.
        Parameters:
        filter - the query filter to apply the the delete operation
        options - the options to apply to the delete operation
        Returns:
        a future with a single element the DeleteResult or with an com.mongodb.MongoException
        Since:
        1.5
      • deleteOne

        void deleteOne​(JsonObject filter,
                       DeleteOptions options,
                       Handler<AsyncResult<DeleteResult>> resultHandler)
        Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.
        Parameters:
        filter - the query filter to apply the the delete operation
        options - the options to apply to the delete operation
        resultHandler - an async result with a single element the DeleteResult or with an com.mongodb.MongoException
        Since:
        1.5
      • deleteOne

        Future<DeleteResult> deleteOne​(ClientSession clientSession,
                                       JsonObject filter)
        Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the delete operation
        Returns:
        a future with a single element the DeleteResult or with an com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • deleteOne

        void deleteOne​(ClientSession clientSession,
                       JsonObject filter,
                       Handler<AsyncResult<DeleteResult>> resultHandler)
        Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the delete operation
        resultHandler - an async result with a single element the DeleteResult or with an com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • deleteOne

        Future<DeleteResult> deleteOne​(ClientSession clientSession,
                                       JsonObject filter,
                                       DeleteOptions options)
        Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the delete operation
        options - the options to apply to the delete operation
        Returns:
        a future with a single element the DeleteResult or with an com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • deleteOne

        void deleteOne​(ClientSession clientSession,
                       JsonObject filter,
                       DeleteOptions options,
                       Handler<AsyncResult<DeleteResult>> resultHandler)
        Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the delete operation
        options - the options to apply to the delete operation
        resultHandler - an async result with a single element the DeleteResult or with an com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • deleteMany

        Future<DeleteResult> deleteMany​(JsonObject filter)
        Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
        Parameters:
        filter - the query filter to apply the the delete operation
        Returns:
        a future with a single element the DeleteResult or with an com.mongodb.MongoException
      • deleteMany

        void deleteMany​(JsonObject filter,
                        Handler<AsyncResult<DeleteResult>> resultHandler)
        Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
        Parameters:
        filter - the query filter to apply the the delete operation
        resultHandler - an async result with a single element the DeleteResult or with an com.mongodb.MongoException
      • deleteMany

        Future<DeleteResult> deleteMany​(JsonObject filter,
                                        DeleteOptions options)
        Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
        Parameters:
        filter - the query filter to apply the the delete operation
        options - the options to apply to the delete operation
        Returns:
        a future with a single element the DeleteResult or with an com.mongodb.MongoException
        Since:
        1.5
      • deleteMany

        void deleteMany​(JsonObject filter,
                        DeleteOptions options,
                        Handler<AsyncResult<DeleteResult>> resultHandler)
        Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
        Parameters:
        filter - the query filter to apply the the delete operation
        options - the options to apply to the delete operation
        resultHandler - an async result with a single element the DeleteResult or with an com.mongodb.MongoException
        Since:
        1.5
      • deleteMany

        Future<DeleteResult> deleteMany​(ClientSession clientSession,
                                        JsonObject filter)
        Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the delete operation
        Returns:
        a future with a single element the DeleteResult or with an com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • deleteMany

        void deleteMany​(ClientSession clientSession,
                        JsonObject filter,
                        Handler<AsyncResult<DeleteResult>> resultHandler)
        Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the delete operation
        resultHandler - an async result with a single element the DeleteResult or with an com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • deleteMany

        Future<DeleteResult> deleteMany​(ClientSession clientSession,
                                        JsonObject filter,
                                        DeleteOptions options)
        Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the delete operation
        options - the options to apply to the delete operation
        Returns:
        a future with a single element the DeleteResult or with an com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • deleteMany

        void deleteMany​(ClientSession clientSession,
                        JsonObject filter,
                        DeleteOptions options,
                        Handler<AsyncResult<DeleteResult>> resultHandler)
        Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the delete operation
        options - the options to apply to the delete operation
        resultHandler - an async result with a single element the DeleteResult or with an com.mongodb.MongoException
        Since:
        1.7
        Since server release
        3.6
      • replaceOne

        Future<UpdateResult> replaceOne​(JsonObject filter,
                                        TDocument replacement)
        Replace a document in the collection according to the specified arguments.
        Parameters:
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        Returns:
        a future with a single element the UpdateResult
        MongoDB documentation
        Replace
      • replaceOne

        void replaceOne​(JsonObject filter,
                        TDocument replacement,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Replace a document in the collection according to the specified arguments.
        Parameters:
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        resultHandler - an async result with a single element the UpdateResult
        MongoDB documentation
        Replace
      • replaceOne

        Future<UpdateResult> replaceOne​(TDocument replacement)
        Replace a document in the collection according to the specified arguments.

        The filter will be based on the id of the provided document

        Parameters:
        replacement - the replacement document
        Returns:
        a future with a single element the UpdateResult
        MongoDB documentation
        Replace
      • replaceOne

        void replaceOne​(TDocument replacement,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Replace a document in the collection according to the specified arguments.

        The filter will be based on the id of the provided document

        Parameters:
        replacement - the replacement document
        resultHandler - an async result with a single element the UpdateResult
        MongoDB documentation
        Replace
      • replaceOne

        Future<UpdateResult> replaceOne​(JsonObject filter,
                                        TDocument replacement,
                                        ReplaceOptions options)
        Replace a document in the collection according to the specified arguments.
        Parameters:
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the replace operation
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.8
        MongoDB documentation
        Replace
      • replaceOne

        void replaceOne​(JsonObject filter,
                        TDocument replacement,
                        ReplaceOptions options,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Replace a document in the collection according to the specified arguments.
        Parameters:
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the replace operation
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.8
        MongoDB documentation
        Replace
      • replaceOne

        Future<UpdateResult> replaceOne​(TDocument replacement,
                                        ReplaceOptions options)
        Replace a document in the collection according to the specified arguments.

        The filter will be based on the id of the provided document

        Parameters:
        replacement - the replacement document
        options - the options to apply to the replace operation
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.8
        MongoDB documentation
        Replace
      • replaceOne

        void replaceOne​(TDocument replacement,
                        ReplaceOptions options,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Replace a document in the collection according to the specified arguments.

        The filter will be based on the id of the provided document

        Parameters:
        replacement - the replacement document
        options - the options to apply to the replace operation
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.8
        MongoDB documentation
        Replace
      • replaceOne

        Future<UpdateResult> replaceOne​(ClientSession clientSession,
                                        JsonObject filter,
                                        TDocument replacement)
        Replace a document in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Replace
      • replaceOne

        void replaceOne​(ClientSession clientSession,
                        JsonObject filter,
                        TDocument replacement,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Replace a document in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Replace
      • replaceOne

        Future<UpdateResult> replaceOne​(ClientSession clientSession,
                                        TDocument replacement)
        Replace a document in the collection according to the specified arguments.

        The filter will be based on the id of the provided document

        Parameters:
        clientSession - the client session with which to associate this operation
        replacement - the replacement document
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Replace
      • replaceOne

        void replaceOne​(ClientSession clientSession,
                        TDocument replacement,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Replace a document in the collection according to the specified arguments.

        The filter will be based on the id of the provided document

        Parameters:
        clientSession - the client session with which to associate this operation
        replacement - the replacement document
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Replace
      • replaceOne

        Future<UpdateResult> replaceOne​(ClientSession clientSession,
                                        JsonObject filter,
                                        TDocument replacement,
                                        ReplaceOptions options)
        Replace a document in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the replace operation
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.8
        Since server release
        3.6
        MongoDB documentation
        Replace
      • replaceOne

        void replaceOne​(ClientSession clientSession,
                        JsonObject filter,
                        TDocument replacement,
                        ReplaceOptions options,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Replace a document in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the replace operation
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.8
        Since server release
        3.6
        MongoDB documentation
        Replace
      • replaceOne

        Future<UpdateResult> replaceOne​(ClientSession clientSession,
                                        TDocument replacement,
                                        ReplaceOptions options)
        Replace a document in the collection according to the specified arguments.

        The filter will be based on the id of the provided document

        Parameters:
        clientSession - the client session with which to associate this operation
        replacement - the replacement document
        options - the options to apply to the replace operation
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.8
        Since server release
        3.6
        MongoDB documentation
        Replace
      • replaceOne

        void replaceOne​(ClientSession clientSession,
                        TDocument replacement,
                        ReplaceOptions options,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Replace a document in the collection according to the specified arguments.

        The filter will be based on the id of the provided document

        Parameters:
        clientSession - the client session with which to associate this operation
        replacement - the replacement document
        options - the options to apply to the replace operation
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.8
        Since server release
        3.6
        MongoDB documentation
        Replace
      • updateOne

        Future<UpdateResult> updateOne​(JsonObject filter,
                                       JsonObject update)
        Update a single document in the collection according to the specified arguments.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        Returns:
        a future with a single element the UpdateResult
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        void updateOne​(JsonObject filter,
                       JsonObject update,
                       Handler<AsyncResult<UpdateResult>> resultHandler)
        Update a single document in the collection according to the specified arguments.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        resultHandler - an async result with a single element the UpdateResult
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        Future<UpdateResult> updateOne​(JsonObject filter,
                                       JsonObject update,
                                       UpdateOptions options)
        Update a single document in the collection according to the specified arguments.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        options - the options to apply to the update operation
        Returns:
        a future with a single element the UpdateResult
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        void updateOne​(JsonObject filter,
                       JsonObject update,
                       UpdateOptions options,
                       Handler<AsyncResult<UpdateResult>> resultHandler)
        Update a single document in the collection according to the specified arguments.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        options - the options to apply to the update operation
        resultHandler - an async result with a single element the UpdateResult
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        Future<UpdateResult> updateOne​(ClientSession clientSession,
                                       JsonObject filter,
                                       JsonObject update)
        Update a single document in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        void updateOne​(ClientSession clientSession,
                       JsonObject filter,
                       JsonObject update,
                       Handler<AsyncResult<UpdateResult>> resultHandler)
        Update a single document in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        Future<UpdateResult> updateOne​(ClientSession clientSession,
                                       JsonObject filter,
                                       JsonObject update,
                                       UpdateOptions options)
        Update a single document in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        options - the options to apply to the update operation
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        void updateOne​(ClientSession clientSession,
                       JsonObject filter,
                       JsonObject update,
                       UpdateOptions options,
                       Handler<AsyncResult<UpdateResult>> resultHandler)
        Update a single document in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        options - the options to apply to the update operation
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        Future<UpdateResult> updateOne​(JsonObject filter,
                                       JsonArray update)
        Update a single document in the collection according to the specified arguments.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        void updateOne​(JsonObject filter,
                       JsonArray update,
                       Handler<AsyncResult<UpdateResult>> resultHandler)
        Update a single document in the collection according to the specified arguments.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        Future<UpdateResult> updateOne​(JsonObject filter,
                                       JsonArray update,
                                       UpdateOptions options)
        Update a single document in the collection according to the specified arguments.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        options - the options to apply to the update operation
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        void updateOne​(JsonObject filter,
                       JsonArray update,
                       UpdateOptions options,
                       Handler<AsyncResult<UpdateResult>> resultHandler)
        Update a single document in the collection according to the specified arguments.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        options - the options to apply to the update operation
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        Future<UpdateResult> updateOne​(ClientSession clientSession,
                                       JsonObject filter,
                                       JsonArray update)
        Update a single document in the collection according to the specified arguments.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        void updateOne​(ClientSession clientSession,
                       JsonObject filter,
                       JsonArray update,
                       Handler<AsyncResult<UpdateResult>> resultHandler)
        Update a single document in the collection according to the specified arguments.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        Future<UpdateResult> updateOne​(ClientSession clientSession,
                                       JsonObject filter,
                                       JsonArray update,
                                       UpdateOptions options)
        Update a single document in the collection according to the specified arguments.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        options - the options to apply to the update operation
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        void updateOne​(ClientSession clientSession,
                       JsonObject filter,
                       JsonArray update,
                       UpdateOptions options,
                       Handler<AsyncResult<UpdateResult>> resultHandler)
        Update a single document in the collection according to the specified arguments.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        options - the options to apply to the update operation
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        Future<UpdateResult> updateMany​(JsonObject filter,
                                        JsonObject update)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        Returns:
        a future with a single element the UpdateResult
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        void updateMany​(JsonObject filter,
                        JsonObject update,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        resultHandler - an async result with a single element the UpdateResult
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        Future<UpdateResult> updateMany​(JsonObject filter,
                                        JsonObject update,
                                        UpdateOptions options)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        options - the options to apply to the update operation
        Returns:
        a future with a single element the UpdateResult
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        void updateMany​(JsonObject filter,
                        JsonObject update,
                        UpdateOptions options,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        options - the options to apply to the update operation
        resultHandler - an async result with a single element the UpdateResult
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        Future<UpdateResult> updateMany​(ClientSession clientSession,
                                        JsonObject filter,
                                        JsonObject update)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        void updateMany​(ClientSession clientSession,
                        JsonObject filter,
                        JsonObject update,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        Future<UpdateResult> updateMany​(ClientSession clientSession,
                                        JsonObject filter,
                                        JsonObject update,
                                        UpdateOptions options)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        options - the options to apply to the update operation
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        void updateMany​(ClientSession clientSession,
                        JsonObject filter,
                        JsonObject update,
                        UpdateOptions options,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        options - the options to apply to the update operation
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        Future<UpdateResult> updateMany​(JsonObject filter,
                                        JsonArray update)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        void updateMany​(JsonObject filter,
                        JsonArray update,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        Future<UpdateResult> updateMany​(JsonObject filter,
                                        JsonArray update,
                                        UpdateOptions options)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        options - the options to apply to the update operation
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        void updateMany​(JsonObject filter,
                        JsonArray update,
                        UpdateOptions options,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        options - the options to apply to the update operation
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        Future<UpdateResult> updateMany​(ClientSession clientSession,
                                        JsonObject filter,
                                        JsonArray update)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        void updateMany​(ClientSession clientSession,
                        JsonObject filter,
                        JsonArray update,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        Future<UpdateResult> updateMany​(ClientSession clientSession,
                                        JsonObject filter,
                                        JsonArray update,
                                        UpdateOptions options)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        options - the options to apply to the update operation
        Returns:
        a future with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        void updateMany​(ClientSession clientSession,
                        JsonObject filter,
                        JsonArray update,
                        UpdateOptions options,
                        Handler<AsyncResult<UpdateResult>> resultHandler)
        Update all documents in the collection according to the specified arguments.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        options - the options to apply to the update operation
        resultHandler - an async result with a single element the UpdateResult
        Since:
        1.12
        Since server release
        4.2
        MongoDB documentation
        Updates
        Update Operators
      • findOneAndDelete

        Future<TDocument> findOneAndDelete​(JsonObject filter)
        Atomically find a document and remove it.
        Parameters:
        filter - the query filter to find the document with
        Returns:
        a future with a single element the document that was removed. If no documents matched the query filter, then null will be returned
      • findOneAndDelete

        void findOneAndDelete​(JsonObject filter,
                              Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and remove it.
        Parameters:
        filter - the query filter to find the document with
        resultHandler - an async result with a single element the document that was removed. If no documents matched the query filter, then null will be returned
      • findOneAndDelete

        Future<TDocument> findOneAndDelete​(JsonObject filter,
                                           FindOneAndDeleteOptions options)
        Atomically find a document and remove it.
        Parameters:
        filter - the query filter to find the document with
        options - the options to apply to the operation
        Returns:
        a future with a single element the document that was removed. If no documents matched the query filter, then null will be returned
      • findOneAndDelete

        void findOneAndDelete​(JsonObject filter,
                              FindOneAndDeleteOptions options,
                              Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and remove it.
        Parameters:
        filter - the query filter to find the document with
        options - the options to apply to the operation
        resultHandler - an async result with a single element the document that was removed. If no documents matched the query filter, then null will be returned
      • findOneAndDelete

        Future<TDocument> findOneAndDelete​(ClientSession clientSession,
                                           JsonObject filter)
        Atomically find a document and remove it.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to find the document with
        Returns:
        a future with a single element the document that was removed. If no documents matched the query filter, then null will be returned
        Since:
        1.7
        Since server release
        3.6
      • findOneAndDelete

        void findOneAndDelete​(ClientSession clientSession,
                              JsonObject filter,
                              Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and remove it.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to find the document with
        resultHandler - an async result with a single element the document that was removed. If no documents matched the query filter, then null will be returned
        Since:
        1.7
        Since server release
        3.6
      • findOneAndDelete

        Future<TDocument> findOneAndDelete​(ClientSession clientSession,
                                           JsonObject filter,
                                           FindOneAndDeleteOptions options)
        Atomically find a document and remove it.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to find the document with
        options - the options to apply to the operation
        Returns:
        a future with a single element the document that was removed. If no documents matched the query filter, then null will be returned
        Since:
        1.7
        Since server release
        3.6
      • findOneAndDelete

        void findOneAndDelete​(ClientSession clientSession,
                              JsonObject filter,
                              FindOneAndDeleteOptions options,
                              Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and remove it.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to find the document with
        options - the options to apply to the operation
        resultHandler - an async result with a single element the document that was removed. If no documents matched the query filter, then null will be returned
        Since:
        1.7
        Since server release
        3.6
      • findOneAndReplace

        Future<TDocument> findOneAndReplace​(JsonObject filter,
                                            TDocument replacement)
        Atomically find a document and replace it.
        Parameters:
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        Returns:
        a future with a single element the document that was replaced. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
      • findOneAndReplace

        void findOneAndReplace​(JsonObject filter,
                               TDocument replacement,
                               Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and replace it.
        Parameters:
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        resultHandler - an async result with a single element the document that was replaced. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
      • findOneAndReplace

        Future<TDocument> findOneAndReplace​(JsonObject filter,
                                            TDocument replacement,
                                            FindOneAndReplaceOptions options)
        Atomically find a document and replace it.
        Parameters:
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the operation
        Returns:
        a future with a single element the document that was replaced. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
      • findOneAndReplace

        void findOneAndReplace​(JsonObject filter,
                               TDocument replacement,
                               FindOneAndReplaceOptions options,
                               Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and replace it.
        Parameters:
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the operation
        resultHandler - an async result with a single element the document that was replaced. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
      • findOneAndReplace

        Future<TDocument> findOneAndReplace​(ClientSession clientSession,
                                            JsonObject filter,
                                            TDocument replacement)
        Atomically find a document and replace it.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        Returns:
        a future with a single element the document that was replaced. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.7
        Since server release
        3.6
      • findOneAndReplace

        void findOneAndReplace​(ClientSession clientSession,
                               JsonObject filter,
                               TDocument replacement,
                               Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and replace it.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        resultHandler - an async result with a single element the document that was replaced. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.7
        Since server release
        3.6
      • findOneAndReplace

        Future<TDocument> findOneAndReplace​(ClientSession clientSession,
                                            JsonObject filter,
                                            TDocument replacement,
                                            FindOneAndReplaceOptions options)
        Atomically find a document and replace it.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the operation
        Returns:
        a future with a single element the document that was replaced. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.7
        Since server release
        3.6
      • findOneAndReplace

        void findOneAndReplace​(ClientSession clientSession,
                               JsonObject filter,
                               TDocument replacement,
                               FindOneAndReplaceOptions options,
                               Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and replace it.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the operation
        resultHandler - an async result with a single element the document that was replaced. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.7
        Since server release
        3.6
      • findOneAndUpdate

        Future<TDocument> findOneAndUpdate​(JsonObject filter,
                                           JsonObject update)
        Atomically find a document and update it.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        Returns:
        a future with a single element the document that was updated before the update was applied. If no documents matched the query filter, then null will be returned
      • findOneAndUpdate

        void findOneAndUpdate​(JsonObject filter,
                              JsonObject update,
                              Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and update it.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        resultHandler - an async result with a single element the document that was updated before the update was applied. If no documents matched the query filter, then null will be returned
      • findOneAndUpdate

        Future<TDocument> findOneAndUpdate​(JsonObject filter,
                                           JsonObject update,
                                           FindOneAndUpdateOptions options)
        Atomically find a document and update it.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        options - the options to apply to the operation
        Returns:
        a future with a single element the document that was updated. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
      • findOneAndUpdate

        void findOneAndUpdate​(JsonObject filter,
                              JsonObject update,
                              FindOneAndUpdateOptions options,
                              Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and update it.
        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        options - the options to apply to the operation
        resultHandler - an async result with a single element the document that was updated. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
      • findOneAndUpdate

        Future<TDocument> findOneAndUpdate​(ClientSession clientSession,
                                           JsonObject filter,
                                           JsonObject update)
        Atomically find a document and update it.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        Returns:
        a future with a single element the document that was updated before the update was applied. If no documents matched the query filter, then null will be returned
        Since:
        1.7
        Since server release
        3.6
      • findOneAndUpdate

        void findOneAndUpdate​(ClientSession clientSession,
                              JsonObject filter,
                              JsonObject update,
                              Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and update it.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        resultHandler - an async result with a single element the document that was updated before the update was applied. If no documents matched the query filter, then null will be returned
        Since:
        1.7
        Since server release
        3.6
      • findOneAndUpdate

        Future<TDocument> findOneAndUpdate​(ClientSession clientSession,
                                           JsonObject filter,
                                           JsonObject update,
                                           FindOneAndUpdateOptions options)
        Atomically find a document and update it.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        options - the options to apply to the operation
        Returns:
        a future with a single element the document that was updated. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.7
        Since server release
        3.6
      • findOneAndUpdate

        void findOneAndUpdate​(ClientSession clientSession,
                              JsonObject filter,
                              JsonObject update,
                              FindOneAndUpdateOptions options,
                              Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and update it.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a document describing the update, which may not be null. The update to apply must include only update operators.
        options - the options to apply to the operation
        resultHandler - an async result with a single element the document that was updated. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.7
        Since server release
        3.6
      • findOneAndUpdate

        Future<TDocument> findOneAndUpdate​(JsonObject filter,
                                           JsonArray update)
        Atomically find a document and update it.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        Returns:
        a future with a single element the document that was updated. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.12
        Since server release
        4.2
      • findOneAndUpdate

        void findOneAndUpdate​(JsonObject filter,
                              JsonArray update,
                              Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and update it.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        resultHandler - an async result with a single element the document that was updated. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.12
        Since server release
        4.2
      • findOneAndUpdate

        Future<TDocument> findOneAndUpdate​(JsonObject filter,
                                           JsonArray update,
                                           FindOneAndUpdateOptions options)
        Atomically find a document and update it.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        options - the options to apply to the operation
        Returns:
        a future with a single element the document that was updated. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.12
        Since server release
        4.2
      • findOneAndUpdate

        void findOneAndUpdate​(JsonObject filter,
                              JsonArray update,
                              FindOneAndUpdateOptions options,
                              Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and update it.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        options - the options to apply to the operation
        resultHandler - an async result with a single element the document that was updated. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.12
        Since server release
        4.2
      • findOneAndUpdate

        Future<TDocument> findOneAndUpdate​(ClientSession clientSession,
                                           JsonObject filter,
                                           JsonArray update)
        Atomically find a document and update it.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        Returns:
        a future with a single element the document that was updated. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.12
        Since server release
        4.2
      • findOneAndUpdate

        void findOneAndUpdate​(ClientSession clientSession,
                              JsonObject filter,
                              JsonArray update,
                              Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and update it.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        resultHandler - an async result with a single element the document that was updated. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.12
        Since server release
        4.2
      • findOneAndUpdate

        Future<TDocument> findOneAndUpdate​(ClientSession clientSession,
                                           JsonObject filter,
                                           JsonArray update,
                                           FindOneAndUpdateOptions options)
        Atomically find a document and update it.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        options - the options to apply to the operation
        Returns:
        a future with a single element the document that was updated. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.12
        Since server release
        4.2
      • findOneAndUpdate

        void findOneAndUpdate​(ClientSession clientSession,
                              JsonObject filter,
                              JsonArray update,
                              FindOneAndUpdateOptions options,
                              Handler<AsyncResult<TDocument>> resultHandler)
        Atomically find a document and update it.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

        Parameters:
        clientSession - the client session with which to associate this operation
        filter - a document describing the query filter, which may not be null.
        update - a pipeline describing the update, which may not be null.
        options - the options to apply to the operation
        resultHandler - an async result with a single element the document that was updated. Depending on the value of the returnOriginal property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned
        Since:
        1.12
        Since server release
        4.2
      • drop

        Future<java.lang.Void> drop()
        Drops this collection from the Database.
        Returns:
        an empty future that indicates when the operation has completed
        MongoDB documentation
        Drop Collection
      • drop

        void drop​(Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drops this collection from the Database.
        Parameters:
        resultHandler - an empty async result that indicates when the operation has completed
        MongoDB documentation
        Drop Collection
      • drop

        Future<java.lang.Void> drop​(ClientSession clientSession)
        Drops this collection from the Database.
        Parameters:
        clientSession - the client session with which to associate this operation
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop Collection
      • drop

        void drop​(ClientSession clientSession,
                  Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drops this collection from the Database.
        Parameters:
        clientSession - the client session with which to associate this operation
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop Collection
      • createIndex

        Future<java.lang.String> createIndex​(JsonObject key)
        Creates an index.
        Parameters:
        key - an object describing the index key(s), which may not be null.
        Returns:
        an empty future that indicates when the operation has completed
        MongoDB documentation
        Ensure Index
      • createIndex

        void createIndex​(JsonObject key,
                         Handler<AsyncResult<java.lang.String>> resultHandler)
        Creates an index.
        Parameters:
        key - an object describing the index key(s), which may not be null.
        resultHandler - an empty async result that indicates when the operation has completed
        MongoDB documentation
        Ensure Index
      • createIndex

        Future<java.lang.String> createIndex​(JsonObject key,
                                             IndexOptions options)
        Creates an index.
        Parameters:
        key - an object describing the index key(s), which may not be null.
        options - the options for the index
        Returns:
        an empty future that indicates when the operation has completed
        MongoDB documentation
        Ensure Index
      • createIndex

        void createIndex​(JsonObject key,
                         IndexOptions options,
                         Handler<AsyncResult<java.lang.String>> resultHandler)
        Creates an index.
        Parameters:
        key - an object describing the index key(s), which may not be null.
        options - the options for the index
        resultHandler - an empty async result that indicates when the operation has completed
        MongoDB documentation
        Ensure Index
      • createIndex

        Future<java.lang.String> createIndex​(ClientSession clientSession,
                                             JsonObject key)
        Creates an index.
        Parameters:
        clientSession - the client session with which to associate this operation
        key - an object describing the index key(s), which may not be null.
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Ensure Index
      • createIndex

        void createIndex​(ClientSession clientSession,
                         JsonObject key,
                         Handler<AsyncResult<java.lang.String>> resultHandler)
        Creates an index.
        Parameters:
        clientSession - the client session with which to associate this operation
        key - an object describing the index key(s), which may not be null.
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Ensure Index
      • createIndex

        Future<java.lang.String> createIndex​(ClientSession clientSession,
                                             JsonObject key,
                                             IndexOptions options)
        Creates an index.
        Parameters:
        clientSession - the client session with which to associate this operation
        key - an object describing the index key(s), which may not be null.
        options - the options for the index
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Ensure Index
      • createIndex

        void createIndex​(ClientSession clientSession,
                         JsonObject key,
                         IndexOptions options,
                         Handler<AsyncResult<java.lang.String>> resultHandler)
        Creates an index.
        Parameters:
        clientSession - the client session with which to associate this operation
        key - an object describing the index key(s), which may not be null.
        options - the options for the index
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Ensure Index
      • createIndexes

        Future<java.lang.String> createIndexes​(java.util.List<IndexModel> indexes)
        Create multiple indexes.
        Parameters:
        indexes - the list of indexes
        Returns:
        an empty future that indicates when the operation has completed
        MongoDB documentation
        Create indexes
      • createIndexes

        void createIndexes​(java.util.List<IndexModel> indexes,
                           Handler<AsyncResult<java.lang.String>> resultHandler)
        Create multiple indexes.
        Parameters:
        indexes - the list of indexes
        resultHandler - an empty async result that indicates when the operation has completed
        MongoDB documentation
        Create indexes
      • createIndexes

        Future<java.lang.String> createIndexes​(java.util.List<IndexModel> indexes,
                                               CreateIndexOptions createIndexOptions)
        Create multiple indexes.
        Parameters:
        indexes - the list of indexes
        createIndexOptions - options to use when creating indexes
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        MongoDB documentation
        Create indexes
      • createIndexes

        void createIndexes​(java.util.List<IndexModel> indexes,
                           CreateIndexOptions createIndexOptions,
                           Handler<AsyncResult<java.lang.String>> resultHandler)
        Create multiple indexes.
        Parameters:
        indexes - the list of indexes
        createIndexOptions - options to use when creating indexes
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        MongoDB documentation
        Create indexes
      • createIndexes

        Future<java.lang.String> createIndexes​(ClientSession clientSession,
                                               java.util.List<IndexModel> indexes)
        Create multiple indexes.
        Parameters:
        clientSession - the client session with which to associate this operation
        indexes - the list of indexes
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Create indexes
      • createIndexes

        void createIndexes​(ClientSession clientSession,
                           java.util.List<IndexModel> indexes,
                           Handler<AsyncResult<java.lang.String>> resultHandler)
        Create multiple indexes.
        Parameters:
        clientSession - the client session with which to associate this operation
        indexes - the list of indexes
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Create indexes
      • createIndexes

        Future<java.lang.String> createIndexes​(ClientSession clientSession,
                                               java.util.List<IndexModel> indexes,
                                               CreateIndexOptions createIndexOptions)
        Create multiple indexes.
        Parameters:
        clientSession - the client session with which to associate this operation
        indexes - the list of indexes
        createIndexOptions - options to use when creating indexes
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Create indexes
      • createIndexes

        void createIndexes​(ClientSession clientSession,
                           java.util.List<IndexModel> indexes,
                           CreateIndexOptions createIndexOptions,
                           Handler<AsyncResult<java.lang.String>> resultHandler)
        Create multiple indexes.
        Parameters:
        clientSession - the client session with which to associate this operation
        indexes - the list of indexes
        createIndexOptions - options to use when creating indexes
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Create indexes
      • listIndexes

        MongoResult<JsonObject> listIndexes()
        Get all the indexes in this collection.
        Returns:
        the fluent list indexes interface
        MongoDB documentation
        listIndexes
      • listIndexes

        MongoResult<JsonObject> listIndexes​(ClientSession clientSession)
        Get all the indexes in this collection.
        Parameters:
        clientSession - the client session with which to associate this operation
        Returns:
        the fluent list indexes interface
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        listIndexes
      • listIndexes

        MongoResult<JsonObject> listIndexes​(ClientSession clientSession,
                                            ListIndexesOptions options)
        Get all the indexes in this collection.
        Parameters:
        clientSession - the client session with which to associate this operation
        options - options
        Returns:
        the fluent list indexes interface
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        listIndexes
      • dropIndex

        Future<java.lang.Void> dropIndex​(java.lang.String indexName)
        Drops the given index.
        Parameters:
        indexName - the name of the index to remove
        Returns:
        an empty future that indicates when the operation has completed
        MongoDB documentation
        Drop Indexes
      • dropIndex

        void dropIndex​(java.lang.String indexName,
                       Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drops the given index.
        Parameters:
        indexName - the name of the index to remove
        resultHandler - an empty async result that indicates when the operation has completed
        MongoDB documentation
        Drop Indexes
      • dropIndex

        Future<java.lang.Void> dropIndex​(JsonObject keys)
        Drops the index given the keys used to create it.
        Parameters:
        keys - the keys of the index to remove
        Returns:
        an empty future that indicates when the operation has completed
        MongoDB documentation
        Drop indexes
      • dropIndex

        void dropIndex​(JsonObject keys,
                       Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drops the index given the keys used to create it.
        Parameters:
        keys - the keys of the index to remove
        resultHandler - an empty async result that indicates when the operation has completed
        MongoDB documentation
        Drop indexes
      • dropIndex

        Future<java.lang.Void> dropIndex​(java.lang.String indexName,
                                         DropIndexOptions dropIndexOptions)
        Drops the given index.
        Parameters:
        indexName - the name of the index to remove
        dropIndexOptions - options to use when dropping indexes
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        MongoDB documentation
        Drop Indexes
      • dropIndex

        void dropIndex​(java.lang.String indexName,
                       DropIndexOptions dropIndexOptions,
                       Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drops the given index.
        Parameters:
        indexName - the name of the index to remove
        dropIndexOptions - options to use when dropping indexes
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        MongoDB documentation
        Drop Indexes
      • dropIndex

        Future<java.lang.Void> dropIndex​(JsonObject keys,
                                         DropIndexOptions dropIndexOptions)
        Drops the index given the keys used to create it.
        Parameters:
        keys - the keys of the index to remove
        dropIndexOptions - options to use when dropping indexes
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        MongoDB documentation
        Drop indexes
      • dropIndex

        void dropIndex​(JsonObject keys,
                       DropIndexOptions dropIndexOptions,
                       Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drops the index given the keys used to create it.
        Parameters:
        keys - the keys of the index to remove
        dropIndexOptions - options to use when dropping indexes
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        MongoDB documentation
        Drop indexes
      • dropIndex

        Future<java.lang.Void> dropIndex​(ClientSession clientSession,
                                         java.lang.String indexName)
        Drops the given index.
        Parameters:
        clientSession - the client session with which to associate this operation
        indexName - the name of the index to remove
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop Indexes
      • dropIndex

        void dropIndex​(ClientSession clientSession,
                       java.lang.String indexName,
                       Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drops the given index.
        Parameters:
        clientSession - the client session with which to associate this operation
        indexName - the name of the index to remove
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop Indexes
      • dropIndex

        Future<java.lang.Void> dropIndex​(ClientSession clientSession,
                                         JsonObject keys)
        Drops the index given the keys used to create it.
        Parameters:
        clientSession - the client session with which to associate this operation
        keys - the keys of the index to remove
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop indexes
      • dropIndex

        void dropIndex​(ClientSession clientSession,
                       JsonObject keys,
                       Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drops the index given the keys used to create it.
        Parameters:
        clientSession - the client session with which to associate this operation
        keys - the keys of the index to remove
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop indexes
      • dropIndex

        Future<java.lang.Void> dropIndex​(ClientSession clientSession,
                                         java.lang.String indexName,
                                         DropIndexOptions dropIndexOptions)
        Drops the given index.
        Parameters:
        clientSession - the client session with which to associate this operation
        indexName - the name of the index to remove
        dropIndexOptions - options to use when dropping indexes
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop Indexes
      • dropIndex

        void dropIndex​(ClientSession clientSession,
                       java.lang.String indexName,
                       DropIndexOptions dropIndexOptions,
                       Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drops the given index.
        Parameters:
        clientSession - the client session with which to associate this operation
        indexName - the name of the index to remove
        dropIndexOptions - options to use when dropping indexes
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop Indexes
      • dropIndex

        Future<java.lang.Void> dropIndex​(ClientSession clientSession,
                                         JsonObject keys,
                                         DropIndexOptions dropIndexOptions)
        Drops the index given the keys used to create it.
        Parameters:
        clientSession - the client session with which to associate this operation
        keys - the keys of the index to remove
        dropIndexOptions - options to use when dropping indexes
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop indexes
      • dropIndex

        void dropIndex​(ClientSession clientSession,
                       JsonObject keys,
                       DropIndexOptions dropIndexOptions,
                       Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drops the index given the keys used to create it.
        Parameters:
        clientSession - the client session with which to associate this operation
        keys - the keys of the index to remove
        dropIndexOptions - options to use when dropping indexes
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop indexes
      • dropIndexes

        Future<java.lang.Void> dropIndexes()
        Drop all the indexes on this collection, except for the default on _id.
        Returns:
        an empty future that indicates when the operation has completed
        MongoDB documentation
        Drop Indexes
      • dropIndexes

        void dropIndexes​(Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drop all the indexes on this collection, except for the default on _id.
        Parameters:
        resultHandler - an empty async result that indicates when the operation has completed
        MongoDB documentation
        Drop Indexes
      • dropIndexes

        Future<java.lang.Void> dropIndexes​(DropIndexOptions dropIndexOptions)
        Drop all the indexes on this collection, except for the default on _id.
        Parameters:
        dropIndexOptions - options to use when dropping indexes
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        MongoDB documentation
        Drop Indexes
      • dropIndexes

        void dropIndexes​(DropIndexOptions dropIndexOptions,
                         Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drop all the indexes on this collection, except for the default on _id.
        Parameters:
        dropIndexOptions - options to use when dropping indexes
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        MongoDB documentation
        Drop Indexes
      • dropIndexes

        Future<java.lang.Void> dropIndexes​(ClientSession clientSession)
        Drop all the indexes on this collection, except for the default on _id.
        Parameters:
        clientSession - the client session with which to associate this operation
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop Indexes
      • dropIndexes

        void dropIndexes​(ClientSession clientSession,
                         Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drop all the indexes on this collection, except for the default on _id.
        Parameters:
        clientSession - the client session with which to associate this operation
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop Indexes
      • dropIndexes

        Future<java.lang.Void> dropIndexes​(ClientSession clientSession,
                                           DropIndexOptions dropIndexOptions)
        Drop all the indexes on this collection, except for the default on _id.
        Parameters:
        clientSession - the client session with which to associate this operation
        dropIndexOptions - options to use when dropping indexes
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop Indexes
      • dropIndexes

        void dropIndexes​(ClientSession clientSession,
                         DropIndexOptions dropIndexOptions,
                         Handler<AsyncResult<java.lang.Void>> resultHandler)
        Drop all the indexes on this collection, except for the default on _id.
        Parameters:
        clientSession - the client session with which to associate this operation
        dropIndexOptions - options to use when dropping indexes
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Drop Indexes
      • renameCollection

        Future<java.lang.Void> renameCollection​(MongoNamespace newCollectionNamespace)
        Rename the collection with oldCollectionName to the newCollectionName.
        Parameters:
        newCollectionNamespace - the namespace the collection will be renamed to
        Returns:
        an empty future that indicates when the operation has completed
        MongoDB documentation
        Rename collection
      • renameCollection

        void renameCollection​(MongoNamespace newCollectionNamespace,
                              Handler<AsyncResult<java.lang.Void>> resultHandler)
        Rename the collection with oldCollectionName to the newCollectionName.
        Parameters:
        newCollectionNamespace - the namespace the collection will be renamed to
        resultHandler - an empty async result that indicates when the operation has completed
        MongoDB documentation
        Rename collection
      • renameCollection

        Future<java.lang.Void> renameCollection​(MongoNamespace newCollectionNamespace,
                                                RenameCollectionOptions options)
        Rename the collection with oldCollectionName to the newCollectionName.
        Parameters:
        newCollectionNamespace - the name the collection will be renamed to
        options - the options for renaming a collection
        Returns:
        an empty future that indicates when the operation has completed
        MongoDB documentation
        Rename collection
      • renameCollection

        void renameCollection​(MongoNamespace newCollectionNamespace,
                              RenameCollectionOptions options,
                              Handler<AsyncResult<java.lang.Void>> resultHandler)
        Rename the collection with oldCollectionName to the newCollectionName.
        Parameters:
        newCollectionNamespace - the name the collection will be renamed to
        options - the options for renaming a collection
        resultHandler - an empty async result that indicates when the operation has completed
        MongoDB documentation
        Rename collection
      • renameCollection

        Future<java.lang.Void> renameCollection​(ClientSession clientSession,
                                                MongoNamespace newCollectionNamespace)
        Rename the collection with oldCollectionName to the newCollectionName.
        Parameters:
        clientSession - the client session with which to associate this operation
        newCollectionNamespace - the namespace the collection will be renamed to
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Rename collection
      • renameCollection

        void renameCollection​(ClientSession clientSession,
                              MongoNamespace newCollectionNamespace,
                              Handler<AsyncResult<java.lang.Void>> resultHandler)
        Rename the collection with oldCollectionName to the newCollectionName.
        Parameters:
        clientSession - the client session with which to associate this operation
        newCollectionNamespace - the namespace the collection will be renamed to
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Rename collection
      • renameCollection

        Future<java.lang.Void> renameCollection​(ClientSession clientSession,
                                                MongoNamespace newCollectionNamespace,
                                                RenameCollectionOptions options)
        Rename the collection with oldCollectionName to the newCollectionName.
        Parameters:
        clientSession - the client session with which to associate this operation
        newCollectionNamespace - the name the collection will be renamed to
        options - the options for renaming a collection
        Returns:
        an empty future that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Rename collection
      • renameCollection

        void renameCollection​(ClientSession clientSession,
                              MongoNamespace newCollectionNamespace,
                              RenameCollectionOptions options,
                              Handler<AsyncResult<java.lang.Void>> resultHandler)
        Rename the collection with oldCollectionName to the newCollectionName.
        Parameters:
        clientSession - the client session with which to associate this operation
        newCollectionNamespace - the name the collection will be renamed to
        options - the options for renaming a collection
        resultHandler - an empty async result that indicates when the operation has completed
        Since:
        1.7
        Since server release
        3.6
        MongoDB documentation
        Rename collection