Interface MongoCollection<TDocument>

  • Type Parameters:
    TDocument - The type that this collection will encode documents from and decode documents to.

    @ThreadSafe
    @Deprecated
    public interface MongoCollection<TDocument>
    Deprecated.
    Prefer the Reactive Streams-based asynchronous driver (mongodb-driver-reactivestreams artifactId)
    The MongoCollection interface.

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

    MongoCollection is generic allowing for different types to represent documents. Any custom classes must have a Codec registered in the CodecRegistry. The default CodecRegistry includes built-in support for: BsonDocument and Document.

    Since:
    3.0
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      AggregateIterable<TDocument> aggregate​(ClientSession clientSession, List<? extends org.bson.conversions.Bson> pipeline)
      Deprecated.
      Aggregates documents according to the specified aggregation pipeline.
      <TResult> AggregateIterable<TResult> aggregate​(ClientSession clientSession, List<? extends org.bson.conversions.Bson> pipeline, Class<TResult> resultClass)
      Deprecated.
      Aggregates documents according to the specified aggregation pipeline.
      AggregateIterable<TDocument> aggregate​(List<? extends org.bson.conversions.Bson> pipeline)
      Deprecated.
      Aggregates documents according to the specified aggregation pipeline.
      <TResult> AggregateIterable<TResult> aggregate​(List<? extends org.bson.conversions.Bson> pipeline, Class<TResult> resultClass)
      Deprecated.
      Aggregates documents according to the specified aggregation pipeline.
      void bulkWrite​(ClientSession clientSession, List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>> requests, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult> callback)
      Deprecated.
      Executes a mix of inserts, updates, replaces, and deletes.
      void bulkWrite​(ClientSession clientSession, List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>> requests, com.mongodb.client.model.BulkWriteOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult> callback)
      Deprecated.
      Executes a mix of inserts, updates, replaces, and deletes.
      void bulkWrite​(List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>> requests, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult> callback)
      Deprecated.
      Executes a mix of inserts, updates, replaces, and deletes.
      void bulkWrite​(List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>> requests, com.mongodb.client.model.BulkWriteOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult> callback)
      Deprecated.
      Executes a mix of inserts, updates, replaces, and deletes.
      void count​(ClientSession clientSession, com.mongodb.async.SingleResultCallback<Long> callback)
      void count​(ClientSession clientSession, org.bson.conversions.Bson filter, com.mongodb.async.SingleResultCallback<Long> callback)
      void count​(ClientSession clientSession, org.bson.conversions.Bson filter, com.mongodb.client.model.CountOptions options, com.mongodb.async.SingleResultCallback<Long> callback)
      void count​(com.mongodb.async.SingleResultCallback<Long> callback)
      void count​(org.bson.conversions.Bson filter, com.mongodb.async.SingleResultCallback<Long> callback)
      void count​(org.bson.conversions.Bson filter, com.mongodb.client.model.CountOptions options, com.mongodb.async.SingleResultCallback<Long> callback)
      void countDocuments​(ClientSession clientSession, com.mongodb.async.SingleResultCallback<Long> callback)
      Deprecated.
      Counts the number of documents in the collection.
      void countDocuments​(ClientSession clientSession, org.bson.conversions.Bson filter, com.mongodb.async.SingleResultCallback<Long> callback)
      Deprecated.
      Counts the number of documents in the collection according to the given options.
      void countDocuments​(ClientSession clientSession, org.bson.conversions.Bson filter, com.mongodb.client.model.CountOptions options, com.mongodb.async.SingleResultCallback<Long> callback)
      Deprecated.
      Counts the number of documents in the collection according to the given options.
      void countDocuments​(com.mongodb.async.SingleResultCallback<Long> callback)
      Deprecated.
      Counts the number of documents in the collection.
      void countDocuments​(org.bson.conversions.Bson filter, com.mongodb.async.SingleResultCallback<Long> callback)
      Deprecated.
      Counts the number of documents in the collection according to the given options.
      void countDocuments​(org.bson.conversions.Bson filter, com.mongodb.client.model.CountOptions options, com.mongodb.async.SingleResultCallback<Long> callback)
      Deprecated.
      Counts the number of documents in the collection according to the given options.
      void createIndex​(ClientSession clientSession, org.bson.conversions.Bson key, com.mongodb.async.SingleResultCallback<String> callback)
      Deprecated.
      Creates an index.
      void createIndex​(ClientSession clientSession, org.bson.conversions.Bson key, com.mongodb.client.model.IndexOptions options, com.mongodb.async.SingleResultCallback<String> callback)
      Deprecated.
      Creates an index.
      void createIndex​(org.bson.conversions.Bson key, com.mongodb.async.SingleResultCallback<String> callback)
      Deprecated.
      Creates an index.
      void createIndex​(org.bson.conversions.Bson key, com.mongodb.client.model.IndexOptions options, com.mongodb.async.SingleResultCallback<String> callback)
      Deprecated.
      Creates an index.
      void createIndexes​(ClientSession clientSession, List<com.mongodb.client.model.IndexModel> indexes, com.mongodb.async.SingleResultCallback<List<String>> callback)
      Deprecated.
      Create multiple indexes.
      void createIndexes​(ClientSession clientSession, List<com.mongodb.client.model.IndexModel> indexes, com.mongodb.client.model.CreateIndexOptions createIndexOptions, com.mongodb.async.SingleResultCallback<List<String>> callback)
      Deprecated.
      Create multiple indexes.
      void createIndexes​(List<com.mongodb.client.model.IndexModel> indexes, com.mongodb.async.SingleResultCallback<List<String>> callback)
      Deprecated.
      Create multiple indexes.
      void createIndexes​(List<com.mongodb.client.model.IndexModel> indexes, com.mongodb.client.model.CreateIndexOptions createIndexOptions, com.mongodb.async.SingleResultCallback<List<String>> callback)
      Deprecated.
      Create multiple indexes.
      void deleteMany​(ClientSession clientSession, org.bson.conversions.Bson filter, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
      Deprecated.
      Removes all documents from the collection that match the given query filter.
      void deleteMany​(ClientSession clientSession, org.bson.conversions.Bson filter, com.mongodb.client.model.DeleteOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
      Deprecated.
      Removes all documents from the collection that match the given query filter.
      void deleteMany​(org.bson.conversions.Bson filter, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
      Deprecated.
      Removes all documents from the collection that match the given query filter.
      void deleteMany​(org.bson.conversions.Bson filter, com.mongodb.client.model.DeleteOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
      Deprecated.
      Removes all documents from the collection that match the given query filter.
      void deleteOne​(ClientSession clientSession, org.bson.conversions.Bson filter, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
      Deprecated.
      Removes at most one document from the collection that matches the given filter.
      void deleteOne​(ClientSession clientSession, org.bson.conversions.Bson filter, com.mongodb.client.model.DeleteOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
      Deprecated.
      Removes at most one document from the collection that matches the given filter.
      void deleteOne​(org.bson.conversions.Bson filter, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
      Deprecated.
      Removes at most one document from the collection that matches the given filter.
      void deleteOne​(org.bson.conversions.Bson filter, com.mongodb.client.model.DeleteOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
      Deprecated.
      Removes at most one document from the collection that matches the given filter.
      <TResult> DistinctIterable<TResult> distinct​(ClientSession clientSession, String fieldName, Class<TResult> resultClass)
      Deprecated.
      Gets the distinct values of the specified field name.
      <TResult> DistinctIterable<TResult> distinct​(ClientSession clientSession, String fieldName, org.bson.conversions.Bson filter, Class<TResult> resultClass)
      Deprecated.
      Gets the distinct values of the specified field name.
      <TResult> DistinctIterable<TResult> distinct​(String fieldName, Class<TResult> resultClass)
      Deprecated.
      Gets the distinct values of the specified field name.
      <TResult> DistinctIterable<TResult> distinct​(String fieldName, org.bson.conversions.Bson filter, Class<TResult> resultClass)
      Deprecated.
      Gets the distinct values of the specified field name.
      void drop​(ClientSession clientSession, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drops this collection from the Database.
      void drop​(com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drops this collection from the Database.
      void dropIndex​(ClientSession clientSession, String indexName, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drops the index given its name.
      void dropIndex​(ClientSession clientSession, String indexName, com.mongodb.client.model.DropIndexOptions dropIndexOptions, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drops the index given its name.
      void dropIndex​(ClientSession clientSession, org.bson.conversions.Bson keys, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drops the index given the keys used to create it.
      void dropIndex​(ClientSession clientSession, org.bson.conversions.Bson keys, com.mongodb.client.model.DropIndexOptions dropIndexOptions, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drops the index given the keys used to create it.
      void dropIndex​(String indexName, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drops the index given its name.
      void dropIndex​(String indexName, com.mongodb.client.model.DropIndexOptions dropIndexOptions, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drops the index given its name.
      void dropIndex​(org.bson.conversions.Bson keys, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drops the index given the keys used to create it.
      void dropIndex​(org.bson.conversions.Bson keys, com.mongodb.client.model.DropIndexOptions dropIndexOptions, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drops the index given the keys used to create it.
      void dropIndexes​(ClientSession clientSession, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drop all the indexes on this collection, except for the default on _id.
      void dropIndexes​(ClientSession clientSession, com.mongodb.client.model.DropIndexOptions dropIndexOptions, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drop all the indexes on this collection, except for the default on _id.
      void dropIndexes​(com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drop all the indexes on this collection, except for the default on _id.
      void dropIndexes​(com.mongodb.client.model.DropIndexOptions dropIndexOptions, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drop all the indexes on this collection, except for the default on _id.
      void estimatedDocumentCount​(com.mongodb.async.SingleResultCallback<Long> callback)
      Deprecated.
      Gets an estimate of the count of documents in a collection using collection metadata.
      void estimatedDocumentCount​(com.mongodb.client.model.EstimatedDocumentCountOptions options, com.mongodb.async.SingleResultCallback<Long> callback)
      Deprecated.
      Gets an estimate of the count of documents in a collection using collection metadata.
      FindIterable<TDocument> find()
      Deprecated.
      Finds all documents in the collection.
      FindIterable<TDocument> find​(ClientSession clientSession)
      Deprecated.
      Finds all documents in the collection.
      <TResult> FindIterable<TResult> find​(ClientSession clientSession, Class<TResult> resultClass)
      Deprecated.
      Finds all documents in the collection.
      FindIterable<TDocument> find​(ClientSession clientSession, org.bson.conversions.Bson filter)
      Deprecated.
      Finds all documents in the collection.
      <TResult> FindIterable<TResult> find​(ClientSession clientSession, org.bson.conversions.Bson filter, Class<TResult> resultClass)
      Deprecated.
      Finds all documents in the collection.
      <TResult> FindIterable<TResult> find​(Class<TResult> resultClass)
      Deprecated.
      Finds all documents in the collection.
      FindIterable<TDocument> find​(org.bson.conversions.Bson filter)
      Deprecated.
      Finds all documents in the collection.
      <TResult> FindIterable<TResult> find​(org.bson.conversions.Bson filter, Class<TResult> resultClass)
      Deprecated.
      Finds all documents in the collection.
      void findOneAndDelete​(ClientSession clientSession, org.bson.conversions.Bson filter, com.mongodb.async.SingleResultCallback<TDocument> callback)
      Deprecated.
      Atomically find a document and remove it.
      void findOneAndDelete​(ClientSession clientSession, org.bson.conversions.Bson filter, com.mongodb.client.model.FindOneAndDeleteOptions options, com.mongodb.async.SingleResultCallback<TDocument> callback)
      Deprecated.
      Atomically find a document and remove it.
      void findOneAndDelete​(org.bson.conversions.Bson filter, com.mongodb.async.SingleResultCallback<TDocument> callback)
      Deprecated.
      Atomically find a document and remove it.
      void findOneAndDelete​(org.bson.conversions.Bson filter, com.mongodb.client.model.FindOneAndDeleteOptions options, com.mongodb.async.SingleResultCallback<TDocument> callback)
      Deprecated.
      Atomically find a document and remove it.
      void findOneAndReplace​(ClientSession clientSession, org.bson.conversions.Bson filter, TDocument replacement, com.mongodb.async.SingleResultCallback<TDocument> callback)
      Deprecated.
      Atomically find a document and replace it.
      void findOneAndReplace​(ClientSession clientSession, org.bson.conversions.Bson filter, TDocument replacement, com.mongodb.client.model.FindOneAndReplaceOptions options, com.mongodb.async.SingleResultCallback<TDocument> callback)
      Deprecated.
      Atomically find a document and replace it.
      void findOneAndReplace​(org.bson.conversions.Bson filter, TDocument replacement, com.mongodb.async.SingleResultCallback<TDocument> callback)
      Deprecated.
      Atomically find a document and replace it.
      void findOneAndReplace​(org.bson.conversions.Bson filter, TDocument replacement, com.mongodb.client.model.FindOneAndReplaceOptions options, com.mongodb.async.SingleResultCallback<TDocument> callback)
      Deprecated.
      Atomically find a document and replace it.
      void findOneAndUpdate​(ClientSession clientSession, org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.async.SingleResultCallback<TDocument> callback)
      Deprecated.
      Atomically find a document and update it.
      void findOneAndUpdate​(ClientSession clientSession, org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.client.model.FindOneAndUpdateOptions options, com.mongodb.async.SingleResultCallback<TDocument> callback)
      Deprecated.
      Atomically find a document and update it.
      void findOneAndUpdate​(org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.async.SingleResultCallback<TDocument> callback)
      Deprecated.
      Atomically find a document and update it.
      void findOneAndUpdate​(org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.client.model.FindOneAndUpdateOptions options, com.mongodb.async.SingleResultCallback<TDocument> callback)
      Deprecated.
      Atomically find a document and update it.
      org.bson.codecs.configuration.CodecRegistry getCodecRegistry()
      Deprecated.
      Get the codec registry for the MongoCollection.
      Class<TDocument> getDocumentClass()
      Deprecated.
      Get the class of documents stored in this collection.
      com.mongodb.MongoNamespace getNamespace()
      Deprecated.
      Gets the namespace of this collection.
      com.mongodb.ReadConcern getReadConcern()
      Deprecated.
      Get the read concern for the MongoCollection.
      com.mongodb.ReadPreference getReadPreference()
      Deprecated.
      Get the read preference for the MongoCollection.
      com.mongodb.WriteConcern getWriteConcern()
      Deprecated.
      Get the write concern for the MongoCollection.
      void insertMany​(ClientSession clientSession, List<? extends TDocument> documents, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Inserts one or more documents.
      void insertMany​(ClientSession clientSession, List<? extends TDocument> documents, com.mongodb.client.model.InsertManyOptions options, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Inserts one or more documents.
      void insertMany​(List<? extends TDocument> documents, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Inserts one or more documents.
      void insertMany​(List<? extends TDocument> documents, com.mongodb.client.model.InsertManyOptions options, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Inserts one or more documents.
      void insertOne​(ClientSession clientSession, TDocument document, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Inserts the provided document.
      void insertOne​(ClientSession clientSession, TDocument document, com.mongodb.client.model.InsertOneOptions options, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Inserts the provided document.
      void insertOne​(TDocument document, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Inserts the provided document.
      void insertOne​(TDocument document, com.mongodb.client.model.InsertOneOptions options, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Inserts the provided document.
      ListIndexesIterable<org.bson.Document> listIndexes()
      Deprecated.
      Get all the indexes in this collection.
      ListIndexesIterable<org.bson.Document> listIndexes​(ClientSession clientSession)
      Deprecated.
      Get all the indexes in this collection.
      <TResult> ListIndexesIterable<TResult> listIndexes​(ClientSession clientSession, Class<TResult> resultClass)
      Deprecated.
      Get all the indexes in this collection.
      <TResult> ListIndexesIterable<TResult> listIndexes​(Class<TResult> resultClass)
      Deprecated.
      Get all the indexes in this collection.
      MapReduceIterable<TDocument> mapReduce​(ClientSession clientSession, String mapFunction, String reduceFunction)
      Deprecated.
      Aggregates documents according to the specified map-reduce function.
      <TResult> MapReduceIterable<TResult> mapReduce​(ClientSession clientSession, String mapFunction, String reduceFunction, Class<TResult> resultClass)
      Deprecated.
      Aggregates documents according to the specified map-reduce function.
      MapReduceIterable<TDocument> mapReduce​(String mapFunction, String reduceFunction)
      Deprecated.
      Aggregates documents according to the specified map-reduce function.
      <TResult> MapReduceIterable<TResult> mapReduce​(String mapFunction, String reduceFunction, Class<TResult> resultClass)
      Deprecated.
      Aggregates documents according to the specified map-reduce function.
      void renameCollection​(ClientSession clientSession, com.mongodb.MongoNamespace newCollectionNamespace, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Rename the collection with oldCollectionName to the newCollectionName.
      void renameCollection​(ClientSession clientSession, com.mongodb.MongoNamespace newCollectionNamespace, com.mongodb.client.model.RenameCollectionOptions options, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Rename the collection with oldCollectionName to the newCollectionName.
      void renameCollection​(com.mongodb.MongoNamespace newCollectionNamespace, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Rename the collection with oldCollectionName to the newCollectionName.
      void renameCollection​(com.mongodb.MongoNamespace newCollectionNamespace, com.mongodb.client.model.RenameCollectionOptions options, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Rename the collection with oldCollectionName to the newCollectionName.
      void replaceOne​(ClientSession clientSession, org.bson.conversions.Bson filter, TDocument replacement, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      Deprecated.
      Replace a document in the collection according to the specified arguments.
      void replaceOne​(ClientSession clientSession, org.bson.conversions.Bson filter, TDocument replacement, com.mongodb.client.model.ReplaceOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      Deprecated.
      Replace a document in the collection according to the specified arguments.
      void replaceOne​(ClientSession clientSession, org.bson.conversions.Bson filter, TDocument replacement, com.mongodb.client.model.UpdateOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      void replaceOne​(org.bson.conversions.Bson filter, TDocument replacement, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      Deprecated.
      Replace a document in the collection according to the specified arguments.
      void replaceOne​(org.bson.conversions.Bson filter, TDocument replacement, com.mongodb.client.model.ReplaceOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      Deprecated.
      Replace a document in the collection according to the specified arguments.
      void replaceOne​(org.bson.conversions.Bson filter, TDocument replacement, com.mongodb.client.model.UpdateOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      void updateMany​(ClientSession clientSession, org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      Deprecated.
      Update all documents in the collection according to the specified arguments.
      void updateMany​(ClientSession clientSession, org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.client.model.UpdateOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      Deprecated.
      Update all documents in the collection according to the specified arguments.
      void updateMany​(org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      Deprecated.
      Update all documents in the collection according to the specified arguments.
      void updateMany​(org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.client.model.UpdateOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      Deprecated.
      Update all documents in the collection according to the specified arguments.
      void updateOne​(ClientSession clientSession, org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      Deprecated.
      Update a single document in the collection according to the specified arguments.
      void updateOne​(ClientSession clientSession, org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.client.model.UpdateOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      Deprecated.
      Update a single document in the collection according to the specified arguments.
      void updateOne​(org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      Deprecated.
      Update a single document in the collection according to the specified arguments.
      void updateOne​(org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.client.model.UpdateOptions options, com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
      Deprecated.
      Update a single document in the collection according to the specified arguments.
      ChangeStreamIterable<TDocument> watch()
      Deprecated.
      Creates a change stream for this collection.
      ChangeStreamIterable<TDocument> watch​(ClientSession clientSession)
      Deprecated.
      Creates a change stream for this collection.
      <TResult> ChangeStreamIterable<TResult> watch​(ClientSession clientSession, Class<TResult> resultClass)
      Deprecated.
      Creates a change stream for this collection.
      ChangeStreamIterable<TDocument> watch​(ClientSession clientSession, List<? extends org.bson.conversions.Bson> pipeline)
      Deprecated.
      Creates a change stream for this collection.
      <TResult> ChangeStreamIterable<TResult> watch​(ClientSession clientSession, List<? extends org.bson.conversions.Bson> pipeline, Class<TResult> resultClass)
      Deprecated.
      Creates a change stream for this collection.
      <TResult> ChangeStreamIterable<TResult> watch​(Class<TResult> resultClass)
      Deprecated.
      Creates a change stream for this collection.
      ChangeStreamIterable<TDocument> watch​(List<? extends org.bson.conversions.Bson> pipeline)
      Deprecated.
      Creates a change stream for this collection.
      <TResult> ChangeStreamIterable<TResult> watch​(List<? extends org.bson.conversions.Bson> pipeline, Class<TResult> resultClass)
      Deprecated.
      Creates a change stream for this collection.
      MongoCollection<TDocument> withCodecRegistry​(org.bson.codecs.configuration.CodecRegistry codecRegistry)
      Deprecated.
      Create a new MongoCollection instance with a different codec registry.
      <NewTDocument>
      MongoCollection<NewTDocument>
      withDocumentClass​(Class<NewTDocument> newDocumentClass)
      Deprecated.
      Create a new MongoCollection instance with a different default class to cast any documents returned from the database into..
      MongoCollection<TDocument> withReadConcern​(com.mongodb.ReadConcern readConcern)
      Deprecated.
      Create a new MongoCollection instance with a different read concern.
      MongoCollection<TDocument> withReadPreference​(com.mongodb.ReadPreference readPreference)
      Deprecated.
      Create a new MongoCollection instance with a different read preference.
      MongoCollection<TDocument> withWriteConcern​(com.mongodb.WriteConcern writeConcern)
      Deprecated.
      Create a new MongoCollection instance with a different write concern.
    • Method Detail

      • getNamespace

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

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

        org.bson.codecs.configuration.CodecRegistry getCodecRegistry()
        Deprecated.
        Get the codec registry for the MongoCollection.
        Returns:
        the CodecRegistry
      • getReadPreference

        com.mongodb.ReadPreference getReadPreference()
        Deprecated.
        Get the read preference for the MongoCollection.
        Returns:
        the ReadPreference
      • getWriteConcern

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

        com.mongodb.ReadConcern getReadConcern()
        Deprecated.
        Get the read concern for the MongoCollection.
        Returns:
        the ReadConcern
        Since:
        3.2
        MongoDB documentation
        Read Concern
        Since server release
        3.2
      • withDocumentClass

        <NewTDocument> MongoCollection<NewTDocument> withDocumentClass​(Class<NewTDocument> newDocumentClass)
        Deprecated.
        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:
        newDocumentClass - 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​(org.bson.codecs.configuration.CodecRegistry codecRegistry)
        Deprecated.
        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​(com.mongodb.ReadPreference readPreference)
        Deprecated.
        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​(com.mongodb.WriteConcern writeConcern)
        Deprecated.
        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​(com.mongodb.ReadConcern readConcern)
        Deprecated.
        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:
        3.2
        MongoDB documentation
        Read Concern
        Since server release
        3.2
      • count

        @Deprecated
        void count​(org.bson.conversions.Bson filter,
                   com.mongodb.async.SingleResultCallback<Long> callback)
        Counts the number of documents in the collection according to the given options.
        Parameters:
        filter - the query filter
        callback - the callback passed the number of documents in the collection
      • count

        @Deprecated
        void count​(org.bson.conversions.Bson filter,
                   com.mongodb.client.model.CountOptions options,
                   com.mongodb.async.SingleResultCallback<Long> callback)
        Counts the number of documents in the collection according to the given options.
        Parameters:
        filter - the query filter
        options - the options describing the count
        callback - the callback passed the number of documents in the collection
      • count

        @Deprecated
        void count​(ClientSession clientSession,
                   org.bson.conversions.Bson filter,
                   com.mongodb.async.SingleResultCallback<Long> callback)
        Counts the number of documents in the collection according to the given options.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter
        callback - the callback passed the number of documents in the collection
        Since:
        3.6
        Since server release
        3.6
      • count

        @Deprecated
        void count​(ClientSession clientSession,
                   org.bson.conversions.Bson filter,
                   com.mongodb.client.model.CountOptions options,
                   com.mongodb.async.SingleResultCallback<Long> callback)
        Counts the number of documents in the collection according to the given options.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter
        options - the options describing the count
        callback - the callback passed the number of documents in the collection
        Since:
        3.6
        Since server release
        3.6
      • countDocuments

        void countDocuments​(com.mongodb.async.SingleResultCallback<Long> callback)
        Deprecated.
        Counts the number of documents in the collection.

        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:
        callback - the callback passed the number of documents in the collection
        Since:
        3.8
      • countDocuments

        void countDocuments​(org.bson.conversions.Bson filter,
                            com.mongodb.async.SingleResultCallback<Long> callback)
        Deprecated.
        Counts the number of documents in the collection according to the given options.

        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
        callback - the callback passed the number of documents in the collection
        Since:
        3.8
      • countDocuments

        void countDocuments​(org.bson.conversions.Bson filter,
                            com.mongodb.client.model.CountOptions options,
                            com.mongodb.async.SingleResultCallback<Long> callback)
        Deprecated.
        Counts the number of documents in the collection according to the given options.

        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
        callback - the callback passed the number of documents in the collection
        Since:
        3.8
      • countDocuments

        void countDocuments​(ClientSession clientSession,
                            com.mongodb.async.SingleResultCallback<Long> callback)
        Deprecated.
        Counts the number of documents in the collection.

        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
        callback - the callback passed the number of documents in the collection
        Since:
        3.8
        Since server release
        3.6
      • countDocuments

        void countDocuments​(ClientSession clientSession,
                            org.bson.conversions.Bson filter,
                            com.mongodb.async.SingleResultCallback<Long> callback)
        Deprecated.
        Counts the number of documents in the collection according to the given options.

        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
        callback - the callback passed the number of documents in the collection
        Since:
        3.8
        Since server release
        3.6
      • countDocuments

        void countDocuments​(ClientSession clientSession,
                            org.bson.conversions.Bson filter,
                            com.mongodb.client.model.CountOptions options,
                            com.mongodb.async.SingleResultCallback<Long> callback)
        Deprecated.
        Counts the number of documents in the collection according to the given options.

        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
        callback - the callback passed the number of documents in the collection
        Since:
        3.8
        Since server release
        3.6
      • estimatedDocumentCount

        void estimatedDocumentCount​(com.mongodb.async.SingleResultCallback<Long> callback)
        Deprecated.
        Gets an estimate of the count of documents in a collection using collection metadata.
        Parameters:
        callback - the callback passed the number of documents in the collection
        Since:
        3.8
      • estimatedDocumentCount

        void estimatedDocumentCount​(com.mongodb.client.model.EstimatedDocumentCountOptions options,
                                    com.mongodb.async.SingleResultCallback<Long> callback)
        Deprecated.
        Gets an estimate of the count of documents in a collection using collection metadata.
        Parameters:
        options - the options describing the count
        callback - the callback passed the number of documents in the collection
        Since:
        3.8
      • distinct

        <TResult> DistinctIterable<TResult> distinct​(String fieldName,
                                                     Class<TResult> resultClass)
        Deprecated.
        Gets the distinct values of the specified field name.
        Type Parameters:
        TResult - the target type of the iterable.
        Parameters:
        fieldName - the field name
        resultClass - the default class to cast any distinct items into.
        Returns:
        an iterable of distinct values
        MongoDB documentation
        Distinct
      • distinct

        <TResult> DistinctIterable<TResult> distinct​(String fieldName,
                                                     org.bson.conversions.Bson filter,
                                                     Class<TResult> resultClass)
        Deprecated.
        Gets the distinct values of the specified field name.
        Type Parameters:
        TResult - the target type of the iterable.
        Parameters:
        fieldName - the field name
        filter - the query filter
        resultClass - the default class to cast any distinct items into.
        Returns:
        an iterable of distinct values
        MongoDB documentation
        Distinct
      • distinct

        <TResult> DistinctIterable<TResult> distinct​(ClientSession clientSession,
                                                     String fieldName,
                                                     Class<TResult> resultClass)
        Deprecated.
        Gets the distinct values of the specified field name.
        Type Parameters:
        TResult - the target type of the iterable.
        Parameters:
        clientSession - the client session with which to associate this operation
        fieldName - the field name
        resultClass - the default class to cast any distinct items into.
        Returns:
        an iterable of distinct values
        Since:
        3.6
        MongoDB documentation
        Distinct
        Since server release
        3.6
      • distinct

        <TResult> DistinctIterable<TResult> distinct​(ClientSession clientSession,
                                                     String fieldName,
                                                     org.bson.conversions.Bson filter,
                                                     Class<TResult> resultClass)
        Deprecated.
        Gets the distinct values of the specified field name.
        Type Parameters:
        TResult - the target type of the iterable.
        Parameters:
        clientSession - the client session with which to associate this operation
        fieldName - the field name
        filter - the query filter
        resultClass - the default class to cast any distinct items into.
        Returns:
        an iterable of distinct values
        Since:
        3.6
        MongoDB documentation
        Distinct
        Since server release
        3.6
      • find

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

        <TResult> FindIterable<TResult> find​(Class<TResult> resultClass)
        Deprecated.
        Finds all documents in the collection.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        resultClass - the class to decode each document into
        Returns:
        the find iterable interface
        MongoDB documentation
        Find
      • find

        FindIterable<TDocument> find​(org.bson.conversions.Bson filter)
        Deprecated.
        Finds all documents in the collection.
        Parameters:
        filter - the query filter
        Returns:
        the find iterable interface
        MongoDB documentation
        Find
      • find

        <TResult> FindIterable<TResult> find​(org.bson.conversions.Bson filter,
                                             Class<TResult> resultClass)
        Deprecated.
        Finds all documents in the collection.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        filter - the query filter
        resultClass - the class to decode each document into
        Returns:
        the find iterable interface
        MongoDB documentation
        Find
      • find

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

        <TResult> FindIterable<TResult> find​(ClientSession clientSession,
                                             Class<TResult> resultClass)
        Deprecated.
        Finds all documents in the collection.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        clientSession - the client session with which to associate this operation
        resultClass - the class to decode each document into
        Returns:
        the find iterable interface
        Since:
        3.6
        MongoDB documentation
        Find
        Since server release
        3.6
      • find

        FindIterable<TDocument> find​(ClientSession clientSession,
                                     org.bson.conversions.Bson filter)
        Deprecated.
        Finds all documents in the collection.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter
        Returns:
        the find iterable interface
        Since:
        3.6
        MongoDB documentation
        Find
        Since server release
        3.6
      • find

        <TResult> FindIterable<TResult> find​(ClientSession clientSession,
                                             org.bson.conversions.Bson filter,
                                             Class<TResult> resultClass)
        Deprecated.
        Finds all documents in the collection.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        clientSession - the client session with which to associate this operation
        filter - the query filter
        resultClass - the class to decode each document into
        Returns:
        the find iterable interface
        Since:
        3.6
        MongoDB documentation
        Find
        Since server release
        3.6
      • aggregate

        AggregateIterable<TDocument> aggregate​(List<? extends org.bson.conversions.Bson> pipeline)
        Deprecated.
        Aggregates documents according to the specified aggregation pipeline. If the pipeline ends with a $out or $merge stage, the returned iterable will be a query of the collection that the aggregation was written to. Note that in this case the pipeline will be executed even if the iterable is never iterated.
        Parameters:
        pipeline - the aggregate pipeline
        Returns:
        an iterable containing the result of the aggregation operation
        MongoDB documentation
        Aggregation
      • aggregate

        <TResult> AggregateIterable<TResult> aggregate​(List<? extends org.bson.conversions.Bson> pipeline,
                                                       Class<TResult> resultClass)
        Deprecated.
        Aggregates documents according to the specified aggregation pipeline. If the pipeline ends with a $out or $merge stage, the returned iterable will be a query of the collection that the aggregation was written to. Note that in this case the pipeline will be executed even if the iterable is never iterated.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        pipeline - the aggregate pipeline
        resultClass - the class to decode each document into
        Returns:
        an iterable containing the result of the aggregation operation
        MongoDB documentation
        Aggregation
      • aggregate

        AggregateIterable<TDocument> aggregate​(ClientSession clientSession,
                                               List<? extends org.bson.conversions.Bson> pipeline)
        Deprecated.
        Aggregates documents according to the specified aggregation pipeline. If the pipeline ends with a $out or $merge stage, the returned iterable will be a query of the collection that the aggregation was written to. Note that in this case the pipeline will be executed even if the iterable is never iterated.
        Parameters:
        clientSession - the client session with which to associate this operation
        pipeline - the aggregate pipeline
        Returns:
        an iterable containing the result of the aggregation operation
        Since:
        3.6
        MongoDB documentation
        Aggregation
        Since server release
        3.6
      • aggregate

        <TResult> AggregateIterable<TResult> aggregate​(ClientSession clientSession,
                                                       List<? extends org.bson.conversions.Bson> pipeline,
                                                       Class<TResult> resultClass)
        Deprecated.
        Aggregates documents according to the specified aggregation pipeline. If the pipeline ends with a $out or $merge stage, the returned iterable will be a query of the collection that the aggregation was written to. Note that in this case the pipeline will be executed even if the iterable is never iterated.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        clientSession - the client session with which to associate this operation
        pipeline - the aggregate pipeline
        resultClass - the class to decode each document into
        Returns:
        an iterable containing the result of the aggregation operation
        Since:
        3.6
        MongoDB documentation
        Aggregation
        Since server release
        3.6
      • watch

        <TResult> ChangeStreamIterable<TResult> watch​(Class<TResult> resultClass)
        Deprecated.
        Creates a change stream for this collection.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        resultClass - the class to decode each document into
        Returns:
        the change stream iterable
        Since:
        3.6
        MongoDB documentation
        Change Streams
        Since server release
        3.6
      • watch

        ChangeStreamIterable<TDocument> watch​(List<? extends org.bson.conversions.Bson> pipeline)
        Deprecated.
        Creates a change stream for this collection.
        Parameters:
        pipeline - the aggregation pipeline to apply to the change stream
        Returns:
        the change stream iterable
        Since:
        3.6
        MongoDB documentation
        Change Streams
        Since server release
        3.6
      • watch

        <TResult> ChangeStreamIterable<TResult> watch​(List<? extends org.bson.conversions.Bson> pipeline,
                                                      Class<TResult> resultClass)
        Deprecated.
        Creates a change stream for this collection.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        pipeline - the aggregation pipeline to apply to the change stream
        resultClass - the class to decode each document into
        Returns:
        the change stream iterable
        Since:
        3.6
        MongoDB documentation
        Change Streams
        Since server release
        3.6
      • watch

        ChangeStreamIterable<TDocument> watch​(ClientSession clientSession)
        Deprecated.
        Creates a change stream for this collection.
        Parameters:
        clientSession - the client session with which to associate this operation
        Returns:
        the change stream iterable
        Since:
        3.6
        MongoDB documentation
        $changeStream
        Since server release
        3.6
      • watch

        <TResult> ChangeStreamIterable<TResult> watch​(ClientSession clientSession,
                                                      Class<TResult> resultClass)
        Deprecated.
        Creates a change stream for this collection.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        clientSession - the client session with which to associate this operation
        resultClass - the class to decode each document into
        Returns:
        the change stream iterable
        Since:
        3.6
        MongoDB documentation
        $changeStream
        Since server release
        3.6
      • watch

        ChangeStreamIterable<TDocument> watch​(ClientSession clientSession,
                                              List<? extends org.bson.conversions.Bson> pipeline)
        Deprecated.
        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 iterable
        Since:
        3.6
        MongoDB documentation
        $changeStream
        Since server release
        3.6
      • watch

        <TResult> ChangeStreamIterable<TResult> watch​(ClientSession clientSession,
                                                      List<? extends org.bson.conversions.Bson> pipeline,
                                                      Class<TResult> resultClass)
        Deprecated.
        Creates a change stream for this collection.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        clientSession - the client session with which to associate this operation
        pipeline - the aggregation pipeline to apply to the change stream
        resultClass - the class to decode each document into
        Returns:
        the change stream iterable
        Since:
        3.6
        MongoDB documentation
        $changeStream
        Since server release
        3.6
      • mapReduce

        MapReduceIterable<TDocument> mapReduce​(String mapFunction,
                                               String reduceFunction)
        Deprecated.
        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 iterable containing the result of the map-reduce operation
        MongoDB documentation
        map-reduce
      • mapReduce

        <TResult> MapReduceIterable<TResult> mapReduce​(String mapFunction,
                                                       String reduceFunction,
                                                       Class<TResult> resultClass)
        Deprecated.
        Aggregates documents according to the specified map-reduce function.
        Type Parameters:
        TResult - the target document type of the iterable.
        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.
        resultClass - the class to decode each resulting document into.
        Returns:
        an iterable containing the result of the map-reduce operation
        MongoDB documentation
        map-reduce
      • mapReduce

        MapReduceIterable<TDocument> mapReduce​(ClientSession clientSession,
                                               String mapFunction,
                                               String reduceFunction)
        Deprecated.
        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 iterable containing the result of the map-reduce operation
        Since:
        3.6
        MongoDB documentation
        map-reduce
        Since server release
        3.6
      • mapReduce

        <TResult> MapReduceIterable<TResult> mapReduce​(ClientSession clientSession,
                                                       String mapFunction,
                                                       String reduceFunction,
                                                       Class<TResult> resultClass)
        Deprecated.
        Aggregates documents according to the specified map-reduce function.
        Type Parameters:
        TResult - the target document type of the iterable.
        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.
        resultClass - the class to decode each resulting document into.
        Returns:
        an iterable containing the result of the map-reduce operation
        Since:
        3.6
        MongoDB documentation
        map-reduce
        Since server release
        3.6
      • bulkWrite

        void bulkWrite​(List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>> requests,
                       com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult> callback)
        Deprecated.
        Executes a mix of inserts, updates, replaces, and deletes.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled. The eligibility for retryable write support for bulk operations is determined on the whole bulk write. If the requests contain any UpdateManyModels or DeleteManyModels then the bulk operation will not support retryable writes.

        Parameters:
        requests - the writes to execute
        callback - the callback passed the result of the bulk write
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
      • bulkWrite

        void bulkWrite​(List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>> requests,
                       com.mongodb.client.model.BulkWriteOptions options,
                       com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult> callback)
        Deprecated.
        Executes a mix of inserts, updates, replaces, and deletes.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled. The eligibility for retryable write support for bulk operations is determined on the whole bulk write. If the requests contain any UpdateManyModels or DeleteManyModels then the bulk operation will not support retryable writes.

        Parameters:
        requests - the writes to execute
        options - the options to apply to the bulk write operation
        callback - the callback passed the result of the bulk write
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
      • bulkWrite

        void bulkWrite​(ClientSession clientSession,
                       List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>> requests,
                       com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult> callback)
        Deprecated.
        Executes a mix of inserts, updates, replaces, and deletes.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled. The eligibility for retryable write support for bulk operations is determined on the whole bulk write. If the requests contain any UpdateManyModels or DeleteManyModels then the bulk operation will not support retryable writes.

        Parameters:
        clientSession - the client session with which to associate this operation
        requests - the writes to execute
        callback - the callback passed the result of the bulk write
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        Since server release
        3.6
      • bulkWrite

        void bulkWrite​(ClientSession clientSession,
                       List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>> requests,
                       com.mongodb.client.model.BulkWriteOptions options,
                       com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult> callback)
        Deprecated.
        Executes a mix of inserts, updates, replaces, and deletes.

        Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled. The eligibility for retryable write support for bulk operations is determined on the whole bulk write. If the requests contain any UpdateManyModels or DeleteManyModels then the bulk operation will not support retryable writes.

        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
        callback - the callback passed the result of the bulk write
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        Since server release
        3.6
      • insertOne

        void insertOne​(TDocument document,
                       com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Inserts the provided document. If the document is missing an identifier, the driver should generate one.

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

        Parameters:
        document - the document to insert
        callback - the callback that is completed once the insert has completed
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
      • insertOne

        void insertOne​(TDocument document,
                       com.mongodb.client.model.InsertOneOptions options,
                       com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Inserts the provided document. If the document is missing an identifier, the driver should generate one.

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

        Parameters:
        document - the document to insert
        options - the options to apply to the operation
        callback - the callback that is completed once the insert has completed
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.2
      • insertOne

        void insertOne​(ClientSession clientSession,
                       TDocument document,
                       com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Inserts the provided document. If the document is missing an identifier, the driver should generate one.

        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
        document - the document to insert
        callback - the callback that is completed once the insert has completed
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        Since server release
        3.6
      • insertOne

        void insertOne​(ClientSession clientSession,
                       TDocument document,
                       com.mongodb.client.model.InsertOneOptions options,
                       com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Inserts the provided document. If the document is missing an identifier, the driver should generate one.

        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
        document - the document to insert
        options - the options to apply to the operation
        callback - the callback that is completed once the insert has completed
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        Since server release
        3.6
      • insertMany

        void insertMany​(List<? extends TDocument> documents,
                        com.mongodb.client.model.InsertManyOptions options,
                        com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Inserts one or more documents. A call to this method is equivalent to a call to the bulkWrite method

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

        Parameters:
        documents - the documents to insert
        options - the options to apply to the operation
        callback - the callback that is completed once the insert has completed
        Throws:
        com.mongodb.MongoBulkWriteException - if there's an exception in the bulk write operation
        com.mongodb.MongoException - if the write failed due some other failure
        See Also:
        bulkWrite(java.util.List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>>, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult>)
      • insertMany

        void insertMany​(ClientSession clientSession,
                        List<? extends TDocument> documents,
                        com.mongodb.client.model.InsertManyOptions options,
                        com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Inserts one or more documents. A call to this method is equivalent to a call to the bulkWrite method

        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
        documents - the documents to insert
        options - the options to apply to the operation
        callback - the callback that is completed once the insert has completed
        Throws:
        com.mongodb.MongoBulkWriteException - if there's an exception in the bulk write operation
        com.mongodb.MongoException - if the write failed due some other failure
        Since:
        3.6
        See Also:
        bulkWrite(java.util.List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>>, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult>)
        Since server release
        3.6
      • deleteOne

        void deleteOne​(org.bson.conversions.Bson filter,
                       com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
        Deprecated.
        Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

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

        Parameters:
        filter - the query filter to apply the the delete operation
        callback - the callback passed the result of the remove one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
      • deleteOne

        void deleteOne​(org.bson.conversions.Bson filter,
                       com.mongodb.client.model.DeleteOptions options,
                       com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
        Deprecated.
        Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

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

        Parameters:
        filter - the query filter to apply the the delete operation
        options - the options to apply to the delete operation
        callback - the callback passed the result of the remove one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
      • deleteOne

        void deleteOne​(ClientSession clientSession,
                       org.bson.conversions.Bson filter,
                       com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
        Deprecated.
        Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

        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 - the query filter to apply the the delete operation
        callback - the callback passed the result of the remove one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        Since server release
        3.6
      • deleteOne

        void deleteOne​(ClientSession clientSession,
                       org.bson.conversions.Bson filter,
                       com.mongodb.client.model.DeleteOptions options,
                       com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
        Deprecated.
        Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

        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 - the query filter to apply the the delete operation
        options - the options to apply to the delete operation
        callback - the callback passed the result of the remove one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        Since server release
        3.6
      • deleteMany

        void deleteMany​(org.bson.conversions.Bson filter,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
        Deprecated.
        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
        callback - the callback passed the result of the remove many operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
      • deleteMany

        void deleteMany​(org.bson.conversions.Bson filter,
                        com.mongodb.client.model.DeleteOptions options,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
        Deprecated.
        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
        callback - the callback passed the result of the remove many operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
      • deleteMany

        void deleteMany​(ClientSession clientSession,
                        org.bson.conversions.Bson filter,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
        Deprecated.
        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
        callback - the callback passed the result of the remove many operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        Since server release
        3.6
      • deleteMany

        void deleteMany​(ClientSession clientSession,
                        org.bson.conversions.Bson filter,
                        com.mongodb.client.model.DeleteOptions options,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.DeleteResult> callback)
        Deprecated.
        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
        callback - the callback passed the result of the remove many operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        Since server release
        3.6
      • replaceOne

        void replaceOne​(org.bson.conversions.Bson filter,
                        TDocument replacement,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Deprecated.
        Replace a 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 - the query filter to apply the the replace operation
        replacement - the replacement document
        callback - the callback passed the result of the replace one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        MongoDB documentation
        Replace
      • replaceOne

        @Deprecated
        void replaceOne​(org.bson.conversions.Bson filter,
                        TDocument replacement,
                        com.mongodb.client.model.UpdateOptions options,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Replace a 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 - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the replace operation
        callback - the callback passed the result of the replace one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        MongoDB documentation
        Replace
      • replaceOne

        void replaceOne​(org.bson.conversions.Bson filter,
                        TDocument replacement,
                        com.mongodb.client.model.ReplaceOptions options,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Deprecated.
        Replace a 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 - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the replace operation
        callback - the callback passed the result of the replace one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.7
        MongoDB documentation
        Replace
      • replaceOne

        void replaceOne​(ClientSession clientSession,
                        org.bson.conversions.Bson filter,
                        TDocument replacement,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Deprecated.
        Replace a 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 - the query filter to apply the the replace operation
        replacement - the replacement document
        callback - the callback passed the result of the replace one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        MongoDB documentation
        Replace
        Since server release
        3.6
      • replaceOne

        @Deprecated
        void replaceOne​(ClientSession clientSession,
                        org.bson.conversions.Bson filter,
                        TDocument replacement,
                        com.mongodb.client.model.UpdateOptions options,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Replace a 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 - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the replace operation
        callback - the callback passed the result of the replace one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        MongoDB documentation
        Replace
        Since server release
        3.6
      • replaceOne

        void replaceOne​(ClientSession clientSession,
                        org.bson.conversions.Bson filter,
                        TDocument replacement,
                        com.mongodb.client.model.ReplaceOptions options,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Deprecated.
        Replace a 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 - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the replace operation
        callback - the callback passed the result of the replace one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.7
        MongoDB documentation
        Replace
        Since server release
        3.6
      • updateOne

        void updateOne​(org.bson.conversions.Bson filter,
                       org.bson.conversions.Bson update,
                       com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Deprecated.
        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 document describing the update, which may not be null. The update to apply must include only update operators.
        callback - the callback passed the result of the update one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        void updateOne​(org.bson.conversions.Bson filter,
                       org.bson.conversions.Bson update,
                       com.mongodb.client.model.UpdateOptions options,
                       com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Deprecated.
        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 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
        callback - the callback passed the result of the update one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        MongoDB documentation
        Updates
        Update Operators
      • updateOne

        void updateOne​(ClientSession clientSession,
                       org.bson.conversions.Bson filter,
                       org.bson.conversions.Bson update,
                       com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Deprecated.
        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 document describing the update, which may not be null. The update to apply must include only update operators.
        callback - the callback passed the result of the update one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        MongoDB documentation
        Updates
        Update Operators
        Since server release
        3.6
      • updateOne

        void updateOne​(ClientSession clientSession,
                       org.bson.conversions.Bson filter,
                       org.bson.conversions.Bson update,
                       com.mongodb.client.model.UpdateOptions options,
                       com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Deprecated.
        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 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
        callback - the callback passed the result of the update one operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        MongoDB documentation
        Updates
        Update Operators
        Since server release
        3.6
      • updateMany

        void updateMany​(org.bson.conversions.Bson filter,
                        org.bson.conversions.Bson update,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Deprecated.
        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. T
        callback - the callback passed the result of the update many operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        void updateMany​(org.bson.conversions.Bson filter,
                        org.bson.conversions.Bson update,
                        com.mongodb.client.model.UpdateOptions options,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Deprecated.
        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
        callback - the callback passed the result of the update many operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        MongoDB documentation
        Updates
        Update Operators
      • updateMany

        void updateMany​(ClientSession clientSession,
                        org.bson.conversions.Bson filter,
                        org.bson.conversions.Bson update,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Deprecated.
        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. T
        callback - the callback passed the result of the update many operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        MongoDB documentation
        Updates
        Update Operators
        Since server release
        3.6
      • updateMany

        void updateMany​(ClientSession clientSession,
                        org.bson.conversions.Bson filter,
                        org.bson.conversions.Bson update,
                        com.mongodb.client.model.UpdateOptions options,
                        com.mongodb.async.SingleResultCallback<com.mongodb.client.result.UpdateResult> callback)
        Deprecated.
        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
        callback - the callback passed the result of the update many operation
        Throws:
        com.mongodb.MongoWriteException - via the callback if the write failed due to some specific write exception
        com.mongodb.MongoWriteConcernException - via the callback if the write failed due to being unable to fulfil the write concern
        com.mongodb.MongoCommandException - via the callback if the write failed due to a specific command exception
        com.mongodb.MongoException - via the callback if the write failed due some other failure
        Since:
        3.6
        MongoDB documentation
        Updates
        Update Operators
        Since server release
        3.6
      • findOneAndDelete

        void findOneAndDelete​(org.bson.conversions.Bson filter,
                              com.mongodb.async.SingleResultCallback<TDocument> callback)
        Deprecated.
        Atomically find a document and remove it.

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

        Parameters:
        filter - the query filter to find the document with
        callback - the callback passed the document that was removed. If no documents matched the query filter, then null will be returned
      • findOneAndDelete

        void findOneAndDelete​(org.bson.conversions.Bson filter,
                              com.mongodb.client.model.FindOneAndDeleteOptions options,
                              com.mongodb.async.SingleResultCallback<TDocument> callback)
        Deprecated.
        Atomically find a document and remove it.

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

        Parameters:
        filter - the query filter to find the document with
        options - the options to apply to the operation
        callback - the callback passed the document that was removed. If no documents matched the query filter, then null will be returned
      • findOneAndDelete

        void findOneAndDelete​(ClientSession clientSession,
                              org.bson.conversions.Bson filter,
                              com.mongodb.async.SingleResultCallback<TDocument> callback)
        Deprecated.
        Atomically find a document and remove 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 - the query filter to find the document with
        callback - the callback passed the document that was removed. If no documents matched the query filter, then null will be returned
        Since:
        3.6
        Since server release
        3.6
      • findOneAndDelete

        void findOneAndDelete​(ClientSession clientSession,
                              org.bson.conversions.Bson filter,
                              com.mongodb.client.model.FindOneAndDeleteOptions options,
                              com.mongodb.async.SingleResultCallback<TDocument> callback)
        Deprecated.
        Atomically find a document and remove 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 - the query filter to find the document with
        options - the options to apply to the operation
        callback - the callback passed the document that was removed. If no documents matched the query filter, then null will be returned
        Since:
        3.6
        Since server release
        3.6
      • findOneAndReplace

        void findOneAndReplace​(org.bson.conversions.Bson filter,
                               TDocument replacement,
                               com.mongodb.async.SingleResultCallback<TDocument> callback)
        Deprecated.
        Atomically find a document and replace it.

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

        Parameters:
        filter - the query filter to apply the the replace operation
        replacement - the replacement document
        callback - the callback passed 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​(org.bson.conversions.Bson filter,
                               TDocument replacement,
                               com.mongodb.client.model.FindOneAndReplaceOptions options,
                               com.mongodb.async.SingleResultCallback<TDocument> callback)
        Deprecated.
        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
        callback - the callback passed 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​(ClientSession clientSession,
                               org.bson.conversions.Bson filter,
                               TDocument replacement,
                               com.mongodb.async.SingleResultCallback<TDocument> callback)
        Deprecated.
        Atomically find a document and replace 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 - the query filter to apply the the replace operation
        replacement - the replacement document
        callback - the callback passed 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:
        3.6
        Since server release
        3.6
      • findOneAndReplace

        void findOneAndReplace​(ClientSession clientSession,
                               org.bson.conversions.Bson filter,
                               TDocument replacement,
                               com.mongodb.client.model.FindOneAndReplaceOptions options,
                               com.mongodb.async.SingleResultCallback<TDocument> callback)
        Deprecated.
        Atomically find a document and replace 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 - the query filter to apply the the replace operation
        replacement - the replacement document
        options - the options to apply to the operation
        callback - the callback passed 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:
        3.6
        Since server release
        3.6
      • findOneAndUpdate

        void findOneAndUpdate​(org.bson.conversions.Bson filter,
                              org.bson.conversions.Bson update,
                              com.mongodb.async.SingleResultCallback<TDocument> callback)
        Deprecated.
        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 document describing the update, which may not be null. The update to apply must include only update operators.
        callback - the callback passed 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​(org.bson.conversions.Bson filter,
                              org.bson.conversions.Bson update,
                              com.mongodb.client.model.FindOneAndUpdateOptions options,
                              com.mongodb.async.SingleResultCallback<TDocument> callback)
        Deprecated.
        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 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
        callback - the callback passed 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​(ClientSession clientSession,
                              org.bson.conversions.Bson filter,
                              org.bson.conversions.Bson update,
                              com.mongodb.async.SingleResultCallback<TDocument> callback)
        Deprecated.
        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 document describing the update, which may not be null. The update to apply must include only update operators.
        callback - the callback passed the document that was updated before the update was applied. If no documents matched the query filter, then null will be returned
        Since:
        3.6
        Since server release
        3.6
      • findOneAndUpdate

        void findOneAndUpdate​(ClientSession clientSession,
                              org.bson.conversions.Bson filter,
                              org.bson.conversions.Bson update,
                              com.mongodb.client.model.FindOneAndUpdateOptions options,
                              com.mongodb.async.SingleResultCallback<TDocument> callback)
        Deprecated.
        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 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
        callback - the callback passed 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:
        3.6
        Since server release
        3.6
      • drop

        void drop​(com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Drops this collection from the Database.
        Parameters:
        callback - the callback that is completed once the collection has been dropped
        MongoDB documentation
        Drop Collection
      • drop

        void drop​(ClientSession clientSession,
                  com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Drops this collection from the Database.
        Parameters:
        clientSession - the client session with which to associate this operation
        callback - the callback that is completed once the collection has been dropped
        Since:
        3.6
        MongoDB documentation
        Drop Collection
        Since server release
        3.6
      • createIndex

        void createIndex​(org.bson.conversions.Bson key,
                         com.mongodb.async.SingleResultCallback<String> callback)
        Deprecated.
        Creates an index. If successful, the callback will be executed with the name of the created index as the result.
        Parameters:
        key - an object describing the index key(s), which may not be null.
        callback - the callback that is completed once the index has been created
        MongoDB documentation
        Create indexes
      • createIndex

        void createIndex​(org.bson.conversions.Bson key,
                         com.mongodb.client.model.IndexOptions options,
                         com.mongodb.async.SingleResultCallback<String> callback)
        Deprecated.
        Creates an index. If successful, the callback will be executed with the name of the created index as the result.
        Parameters:
        key - an object describing the index key(s), which may not be null.
        options - the options for the index
        callback - the callback that is completed once the index has been created
        MongoDB documentation
        Create indexes
      • createIndex

        void createIndex​(ClientSession clientSession,
                         org.bson.conversions.Bson key,
                         com.mongodb.async.SingleResultCallback<String> callback)
        Deprecated.
        Creates an index. If successful, the callback will be executed with the name of the created index as the result.
        Parameters:
        clientSession - the client session with which to associate this operation
        key - an object describing the index key(s), which may not be null.
        callback - the callback that is completed once the index has been created
        Since:
        3.6
        MongoDB documentation
        Create indexes
        Since server release
        3.6
      • createIndex

        void createIndex​(ClientSession clientSession,
                         org.bson.conversions.Bson key,
                         com.mongodb.client.model.IndexOptions options,
                         com.mongodb.async.SingleResultCallback<String> callback)
        Deprecated.
        Creates an index. If successful, the callback will be executed with the name of the created index as the result.
        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
        callback - the callback that is completed once the index has been created
        Since:
        3.6
        MongoDB documentation
        Create indexes
        Since server release
        3.6
      • createIndexes

        void createIndexes​(List<com.mongodb.client.model.IndexModel> indexes,
                           com.mongodb.async.SingleResultCallback<List<String>> callback)
        Deprecated.
        Create multiple indexes. If successful, the callback will be executed with a list of the names of the created indexes as the result.
        Parameters:
        indexes - the list of indexes
        callback - the callback that is completed once the indexes has been created
        MongoDB documentation
        Create indexes
        Since server release
        2.6
      • createIndexes

        void createIndexes​(List<com.mongodb.client.model.IndexModel> indexes,
                           com.mongodb.client.model.CreateIndexOptions createIndexOptions,
                           com.mongodb.async.SingleResultCallback<List<String>> callback)
        Deprecated.
        Create multiple indexes. If successful, the callback will be executed with a list of the names of the created indexes as the result.
        Parameters:
        indexes - the list of indexes
        createIndexOptions - options to use when creating indexes
        callback - the callback that is completed once the indexes has been created
        Since:
        3.6
        MongoDB documentation
        Create indexes
      • createIndexes

        void createIndexes​(ClientSession clientSession,
                           List<com.mongodb.client.model.IndexModel> indexes,
                           com.mongodb.async.SingleResultCallback<List<String>> callback)
        Deprecated.
        Create multiple indexes. If successful, the callback will be executed with a list of the names of the created indexes as the result.
        Parameters:
        clientSession - the client session with which to associate this operation
        indexes - the list of indexes
        callback - the callback that is completed once the indexes has been created
        Since:
        3.6
        MongoDB documentation
        Create indexes
        Since server release
        3.6
      • createIndexes

        void createIndexes​(ClientSession clientSession,
                           List<com.mongodb.client.model.IndexModel> indexes,
                           com.mongodb.client.model.CreateIndexOptions createIndexOptions,
                           com.mongodb.async.SingleResultCallback<List<String>> callback)
        Deprecated.
        Create multiple indexes. If successful, the callback will be executed with a list of the names of the created indexes as the result.
        Parameters:
        clientSession - the client session with which to associate this operation
        indexes - the list of indexes
        createIndexOptions - options to use when creating indexes
        callback - the callback that is completed once the indexes has been created
        Since:
        3.6
        MongoDB documentation
        Create indexes
        Since server release
        3.6
      • listIndexes

        ListIndexesIterable<org.bson.Document> listIndexes()
        Deprecated.
        Get all the indexes in this collection.
        Returns:
        the list indexes iterable interface
        MongoDB documentation
        List indexes
      • listIndexes

        <TResult> ListIndexesIterable<TResult> listIndexes​(Class<TResult> resultClass)
        Deprecated.
        Get all the indexes in this collection.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        resultClass - the class to decode each document into
        Returns:
        the list indexes iterable interface
        MongoDB documentation
        List indexes
      • listIndexes

        ListIndexesIterable<org.bson.Document> listIndexes​(ClientSession clientSession)
        Deprecated.
        Get all the indexes in this collection.
        Parameters:
        clientSession - the client session with which to associate this operation
        Returns:
        the list indexes iterable interface
        Since:
        3.6
        MongoDB documentation
        List indexes
        Since server release
        3.6
      • listIndexes

        <TResult> ListIndexesIterable<TResult> listIndexes​(ClientSession clientSession,
                                                           Class<TResult> resultClass)
        Deprecated.
        Get all the indexes in this collection.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        clientSession - the client session with which to associate this operation
        resultClass - the class to decode each document into
        Returns:
        the list indexes iterable interface
        Since:
        3.6
        MongoDB documentation
        List indexes
        Since server release
        3.6
      • dropIndex

        void dropIndex​(String indexName,
                       com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Drops the index given its name.
        Parameters:
        indexName - the name of the index to remove
        callback - the callback that is completed once the index has been dropped
        MongoDB documentation
        Drop indexes
      • dropIndex

        void dropIndex​(String indexName,
                       com.mongodb.client.model.DropIndexOptions dropIndexOptions,
                       com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Drops the index given its name.
        Parameters:
        indexName - the name of the index to remove
        dropIndexOptions - options to use when dropping indexes
        callback - the callback that is completed once the index has been dropped
        Since:
        3.6
        MongoDB documentation
        Drop indexes
      • dropIndex

        void dropIndex​(org.bson.conversions.Bson keys,
                       com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Drops the index given the keys used to create it.
        Parameters:
        keys - the keys of the index to remove
        callback - the callback that is completed once the index has been dropped
        MongoDB documentation
        Drop indexes
      • dropIndex

        void dropIndex​(org.bson.conversions.Bson keys,
                       com.mongodb.client.model.DropIndexOptions dropIndexOptions,
                       com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        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
        callback - the callback that is completed once the index has been dropped
        Since:
        3.6
        MongoDB documentation
        Drop indexes
      • dropIndex

        void dropIndex​(ClientSession clientSession,
                       String indexName,
                       com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Drops the index given its name.
        Parameters:
        clientSession - the client session with which to associate this operation
        indexName - the name of the index to remove
        callback - the callback that is completed once the index has been dropped
        Since:
        3.6
        MongoDB documentation
        Drop indexes
        Since server release
        3.6
      • dropIndex

        void dropIndex​(ClientSession clientSession,
                       String indexName,
                       com.mongodb.client.model.DropIndexOptions dropIndexOptions,
                       com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Drops the index given its name.
        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
        callback - the callback that is completed once the index has been dropped
        Since:
        3.6
        MongoDB documentation
        Drop indexes
        Since server release
        3.6
      • dropIndex

        void dropIndex​(ClientSession clientSession,
                       org.bson.conversions.Bson keys,
                       com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        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
        callback - the callback that is completed once the index has been dropped
        Since:
        3.6
        MongoDB documentation
        Drop indexes
        Since server release
        3.6
      • dropIndex

        void dropIndex​(ClientSession clientSession,
                       org.bson.conversions.Bson keys,
                       com.mongodb.client.model.DropIndexOptions dropIndexOptions,
                       com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        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
        callback - the callback that is completed once the index has been dropped
        Since:
        3.6
        MongoDB documentation
        Drop indexes
        Since server release
        3.6
      • dropIndexes

        void dropIndexes​(com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Drop all the indexes on this collection, except for the default on _id.
        Parameters:
        callback - the callback that is completed once all the indexes have been dropped
        MongoDB documentation
        Drop indexes
      • dropIndexes

        void dropIndexes​(com.mongodb.client.model.DropIndexOptions dropIndexOptions,
                         com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Drop all the indexes on this collection, except for the default on _id.
        Parameters:
        dropIndexOptions - options to use when dropping indexes
        callback - the callback that is completed once all the indexes have been dropped
        Since:
        3.6
        MongoDB documentation
        Drop indexes
      • dropIndexes

        void dropIndexes​(ClientSession clientSession,
                         com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Drop all the indexes on this collection, except for the default on _id.
        Parameters:
        clientSession - the client session with which to associate this operation
        callback - the callback that is completed once all the indexes have been dropped
        Since:
        3.6
        MongoDB documentation
        Drop indexes
        Since server release
        3.6
      • dropIndexes

        void dropIndexes​(ClientSession clientSession,
                         com.mongodb.client.model.DropIndexOptions dropIndexOptions,
                         com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        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
        callback - the callback that is completed once all the indexes have been dropped
        Since:
        3.6
        MongoDB documentation
        Drop indexes
        Since server release
        3.6
      • renameCollection

        void renameCollection​(com.mongodb.MongoNamespace newCollectionNamespace,
                              com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Rename the collection with oldCollectionName to the newCollectionName.
        Parameters:
        newCollectionNamespace - the namespace the collection will be renamed to
        callback - the callback that is completed once the collection has been renamed
        Throws:
        com.mongodb.MongoServerException - if you provide a newCollectionName that is the name of an existing collection, or if the oldCollectionName is the name of a collection that doesn't exist
        MongoDB documentation
        Rename collection
      • renameCollection

        void renameCollection​(com.mongodb.MongoNamespace newCollectionNamespace,
                              com.mongodb.client.model.RenameCollectionOptions options,
                              com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        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
        callback - the callback that is completed once the collection has been renamed
        Throws:
        com.mongodb.MongoServerException - if you provide a newCollectionName that is the name of an existing collection and dropTarget is false, or if the oldCollectionName is the name of a collection that doesn't exist
        MongoDB documentation
        Rename collection
      • renameCollection

        void renameCollection​(ClientSession clientSession,
                              com.mongodb.MongoNamespace newCollectionNamespace,
                              com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        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
        callback - the callback that is completed once the collection has been renamed
        Throws:
        com.mongodb.MongoServerException - if you provide a newCollectionName that is the name of an existing collection, or if the oldCollectionName is the name of a collection that doesn't exist
        Since:
        3.6
        MongoDB documentation
        Rename collection
        Since server release
        3.6
      • renameCollection

        void renameCollection​(ClientSession clientSession,
                              com.mongodb.MongoNamespace newCollectionNamespace,
                              com.mongodb.client.model.RenameCollectionOptions options,
                              com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        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
        callback - the callback that is completed once the collection has been renamed
        Throws:
        com.mongodb.MongoServerException - if you provide a newCollectionName that is the name of an existing collection and dropTarget is false, or if the oldCollectionName is the name of a collection that doesn't exist
        Since:
        3.6
        MongoDB documentation
        Rename collection
        Since server release
        3.6