com.mongodb.reactivestreams.client.MongoCollection Maven / Gradle / Ivy
Show all versions of mongodb-driver-reactivestreams Show documentation
/*
* Copyright 2008-present MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mongodb.reactivestreams.client;
import com.mongodb.MongoNamespace;
import com.mongodb.ReadConcern;
import com.mongodb.ReadPreference;
import com.mongodb.WriteConcern;
import com.mongodb.annotations.Alpha;
import com.mongodb.annotations.Reason;
import com.mongodb.annotations.ThreadSafe;
import com.mongodb.bulk.BulkWriteResult;
import com.mongodb.client.model.BulkWriteOptions;
import com.mongodb.client.model.CountOptions;
import com.mongodb.client.model.CreateIndexOptions;
import com.mongodb.client.model.DeleteOptions;
import com.mongodb.client.model.DropCollectionOptions;
import com.mongodb.client.model.DropIndexOptions;
import com.mongodb.client.model.EstimatedDocumentCountOptions;
import com.mongodb.client.model.FindOneAndDeleteOptions;
import com.mongodb.client.model.FindOneAndReplaceOptions;
import com.mongodb.client.model.FindOneAndUpdateOptions;
import com.mongodb.client.model.IndexModel;
import com.mongodb.client.model.IndexOptions;
import com.mongodb.client.model.InsertManyOptions;
import com.mongodb.client.model.InsertOneOptions;
import com.mongodb.client.model.RenameCollectionOptions;
import com.mongodb.client.model.ReplaceOptions;
import com.mongodb.client.model.SearchIndexModel;
import com.mongodb.client.model.UpdateOptions;
import com.mongodb.client.model.WriteModel;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.InsertManyResult;
import com.mongodb.client.result.InsertOneResult;
import com.mongodb.client.result.UpdateResult;
import com.mongodb.lang.Nullable;
import org.bson.Document;
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.conversions.Bson;
import org.reactivestreams.Publisher;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* The MongoCollection interface.
*
* Note: Additions to this interface will not be considered to break binary compatibility.
*
* @param The type that this collection will encode documents from and decode documents to.
* @since 1.0
*/
@ThreadSafe
public interface MongoCollection {
/**
* Gets the namespace of this collection.
*
* @return the namespace
*/
MongoNamespace getNamespace();
/**
* Get the class of documents stored in this collection.
*
* @return the class
*/
Class getDocumentClass();
/**
* Get the codec registry for the MongoCollection.
*
* @return the {@link org.bson.codecs.configuration.CodecRegistry}
*/
CodecRegistry getCodecRegistry();
/**
* Get the read preference for the MongoCollection.
*
* @return the {@link com.mongodb.ReadPreference}
*/
ReadPreference getReadPreference();
/**
* Get the write concern for the MongoCollection.
*
* @return the {@link com.mongodb.WriteConcern}
*/
WriteConcern getWriteConcern();
/**
* Get the read concern for the MongoCollection.
*
* @return the {@link com.mongodb.ReadConcern}
* @mongodb.server.release 3.2
* @since 1.2
*/
ReadConcern getReadConcern();
/**
* The time limit for the full execution of an operation.
*
* If not null the following deprecated options will be ignored:
* {@code waitQueueTimeoutMS}, {@code socketTimeoutMS}, {@code wTimeoutMS}, {@code maxTimeMS} and {@code maxCommitTimeMS}
*
*
* - {@code null} means that the timeout mechanism for operations will defer to using:
*
* - {@code waitQueueTimeoutMS}: The maximum wait time in milliseconds that a thread may wait for a connection to become
* available
* - {@code socketTimeoutMS}: How long a send or receive on a socket can take before timing out.
* - {@code wTimeoutMS}: How long the server will wait for the write concern to be fulfilled before timing out.
* - {@code maxTimeMS}: The cumulative time limit for processing operations on a cursor.
* See: cursor.maxTimeMS.
* - {@code maxCommitTimeMS}: The maximum amount of time to allow a single {@code commitTransaction} command to execute.
* See: {@link com.mongodb.TransactionOptions#getMaxCommitTime}.
*
*
* - {@code 0} means infinite timeout.
* - {@code > 0} The time limit to use for the full execution of an operation.
*
*
* @param timeUnit the time unit
* @return the timeout in the given time unit
* @since 5.2
*/
@Alpha(Reason.CLIENT)
@Nullable
Long getTimeout(TimeUnit timeUnit);
/**
* Create a new MongoCollection instance with a different default class to cast any documents returned from the database into..
*
* @param clazz the default class to cast any documents returned from the database into.
* @param The type that the new collection will encode documents from and decode documents to
* @return a new MongoCollection instance with the different default class
*/
MongoCollection withDocumentClass(Class clazz);
/**
* Create a new MongoCollection instance with a different codec registry.
*
* The {@link CodecRegistry} configured by this method is effectively treated by the driver as an instance of
* {@link org.bson.codecs.configuration.CodecProvider}, which {@link CodecRegistry} extends. So there is no benefit to defining
* a class that implements {@link CodecRegistry}. Rather, an application should always create {@link CodecRegistry} instances
* using the factory methods in {@link org.bson.codecs.configuration.CodecRegistries}.
*
* @param codecRegistry the new {@link org.bson.codecs.configuration.CodecRegistry} for the collection
* @return a new MongoCollection instance with the different codec registry
* @see org.bson.codecs.configuration.CodecRegistries
*/
MongoCollection withCodecRegistry(CodecRegistry codecRegistry);
/**
* Create a new MongoCollection instance with a different read preference.
*
* @param readPreference the new {@link com.mongodb.ReadPreference} for the collection
* @return a new MongoCollection instance with the different readPreference
*/
MongoCollection withReadPreference(ReadPreference readPreference);
/**
* Create a new MongoCollection instance with a different write concern.
*
* @param writeConcern the new {@link com.mongodb.WriteConcern} for the collection
* @return a new MongoCollection instance with the different writeConcern
*/
MongoCollection withWriteConcern(WriteConcern writeConcern);
/**
* Create a new MongoCollection instance with a different read concern.
*
* @param readConcern the new {@link ReadConcern} for the collection
* @return a new MongoCollection instance with the different ReadConcern
* @mongodb.server.release 3.2
* @since 1.2
*/
MongoCollection withReadConcern(ReadConcern readConcern);
/**
* Create a new MongoCollection instance with the set time limit for the full execution of an operation.
*
*
* - {@code 0} means infinite timeout.
* - {@code > 0} The time limit to use for the full execution of an operation.
*
*
* @param timeout the timeout, which must be greater than or equal to 0
* @param timeUnit the time unit
* @return a new MongoCollection instance with the set time limit for the full execution of an operation
* @since 5.2
* @see #getTimeout
*/
@Alpha(Reason.CLIENT)
MongoCollection withTimeout(long timeout, TimeUnit timeUnit);
/**
* Gets an estimate of the count of documents in a collection using collection metadata.
*
*
* Implementation note: this method is implemented using the MongoDB server's count command
*
*
* @return a publisher with a single element indicating the estimated number of documents
* @since 1.9
* @mongodb.driver.manual manual/reference/command/count/#behavior
*/
Publisher estimatedDocumentCount();
/**
* Gets an estimate of the count of documents in a collection using collection metadata.
*
*
* Implementation note: this method is implemented using the MongoDB server's count command
*
*
* @param options the options describing the count
* @return a publisher with a single element indicating the estimated number of documents
* @since 1.9
* @mongodb.driver.manual manual/reference/command/count/#behavior
*/
Publisher estimatedDocumentCount(EstimatedDocumentCountOptions options);
/**
* Counts the number of documents in the collection.
*
*
* Note: For a fast count of the total documents in a collection see {@link #estimatedDocumentCount()}.
* Note: When migrating from {@code count()} to {@code countDocuments()} the following query operators must be replaced:
*
*
*
* +-------------+--------------------------------+
* | Operator | Replacement |
* +=============+================================+
* | $where | $expr |
* +-------------+--------------------------------+
* | $near | $geoWithin with $center |
* +-------------+--------------------------------+
* | $nearSphere | $geoWithin with $centerSphere |
* +-------------+--------------------------------+
*
*
* @return a publisher with a single element indicating the number of documents
* @since 1.9
*/
Publisher countDocuments();
/**
* Counts the number of documents in the collection according to the given options.
*
*
* Note: For a fast count of the total documents in a collection see {@link #estimatedDocumentCount()}.
* Note: When migrating from {@code count()} to {@code countDocuments()} the following query operators must be replaced:
*
*
*
* +-------------+--------------------------------+
* | Operator | Replacement |
* +=============+================================+
* | $where | $expr |
* +-------------+--------------------------------+
* | $near | $geoWithin with $center |
* +-------------+--------------------------------+
* | $nearSphere | $geoWithin with $centerSphere |
* +-------------+--------------------------------+
*
*
* @param filter the query filter
* @return a publisher with a single element indicating the number of documents
* @since 1.9
*/
Publisher countDocuments(Bson filter);
/**
* Counts the number of documents in the collection according to the given options.
*
*
* Note: For a fast count of the total documents in a collection see {@link #estimatedDocumentCount()}.
* Note: When migrating from {@code count()} to {@code countDocuments()} the following query operators must be replaced:
*
*
*
* +-------------+--------------------------------+
* | Operator | Replacement |
* +=============+================================+
* | $where | $expr |
* +-------------+--------------------------------+
* | $near | $geoWithin with $center |
* +-------------+--------------------------------+
* | $nearSphere | $geoWithin with $centerSphere |
* +-------------+--------------------------------+
*
*
* @param filter the query filter
* @param options the options describing the count
* @return a publisher with a single element indicating the number of documents
* @since 1.9
*/
Publisher countDocuments(Bson filter, CountOptions options);
/**
* Counts the number of documents in the collection.
*
*
* Note: For a fast count of the total documents in a collection see {@link #estimatedDocumentCount()}.
* Note: When migrating from {@code count()} to {@code countDocuments()} the following query operators must be replaced:
*
*
*
* +-------------+--------------------------------+
* | Operator | Replacement |
* +=============+================================+
* | $where | $expr |
* +-------------+--------------------------------+
* | $near | $geoWithin with $center |
* +-------------+--------------------------------+
* | $nearSphere | $geoWithin with $centerSphere |
* +-------------+--------------------------------+
*
*
* @param clientSession the client session with which to associate this operation
* @return a publisher with a single element indicating the number of documents
* @mongodb.server.release 3.6
* @since 1.9
*/
Publisher countDocuments(ClientSession clientSession);
/**
* Counts the number of documents in the collection according to the given options.
*
*
* Note: For a fast count of the total documents in a collection see {@link #estimatedDocumentCount()}.
*
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter
* @return a publisher with a single element indicating the number of documents
* @mongodb.server.release 3.6
* @since 1.9
*/
Publisher countDocuments(ClientSession clientSession, Bson filter);
/**
* Counts the number of documents in the collection according to the given options.
*
*
* Note: For a fast count of the total documents in a collection see {@link #estimatedDocumentCount()}.
* Note: When migrating from {@code count()} to {@code countDocuments()} the following query operators must be replaced:
*
*
*
* +-------------+--------------------------------+
* | Operator | Replacement |
* +=============+================================+
* | $where | $expr |
* +-------------+--------------------------------+
* | $near | $geoWithin with $center |
* +-------------+--------------------------------+
* | $nearSphere | $geoWithin with $centerSphere |
* +-------------+--------------------------------+
*
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter
* @param options the options describing the count
* @return a publisher with a single element indicating the number of documents
* @mongodb.server.release 3.6
* @since 1.9
*/
Publisher countDocuments(ClientSession clientSession, Bson filter, CountOptions options);
/**
* Gets the distinct values of the specified field name.
*
* @param fieldName the field name
* @param resultClass the default class to cast any distinct items into.
* @param the target type of the iterable.
* @return a publisher emitting the sequence of distinct values
* @mongodb.driver.manual reference/command/distinct/ Distinct
*/
DistinctPublisher distinct(String fieldName, Class resultClass);
/**
* Gets the distinct values of the specified field name.
*
* @param fieldName the field name
* @param filter the query filter
* @param resultClass the default class to cast any distinct items into.
* @param the target type of the iterable.
* @return an iterable of distinct values
* @mongodb.driver.manual reference/command/distinct/ Distinct
*/
DistinctPublisher distinct(String fieldName, Bson filter, Class resultClass);
/**
* Gets the distinct values of the specified field name.
*
* @param clientSession the client session with which to associate this operation
* @param fieldName the field name
* @param resultClass the default class to cast any distinct items into.
* @param the target type of the iterable.
* @return a publisher emitting the sequence of distinct values
* @mongodb.driver.manual reference/command/distinct/ Distinct
* @mongodb.server.release 3.6
* @since 1.7
*/
DistinctPublisher distinct(ClientSession clientSession, String fieldName, Class resultClass);
/**
* Gets the distinct values of the specified field name.
*
* @param clientSession the client session with which to associate this operation
* @param fieldName the field name
* @param filter the query filter
* @param resultClass the default class to cast any distinct items into.
* @param the target type of the iterable.
* @return an iterable of distinct values
* @mongodb.driver.manual reference/command/distinct/ Distinct
* @mongodb.server.release 3.6
* @since 1.7
*/
DistinctPublisher distinct(ClientSession clientSession, String fieldName, Bson filter, Class resultClass);
/**
* Finds all documents in the collection.
*
* @return the fluent find interface
* @mongodb.driver.manual tutorial/query-documents/ Find
*/
FindPublisher find();
/**
* Finds all documents in the collection.
*
* @param clazz the class to decode each document into
* @param the target document type of the iterable.
* @return the fluent find interface
* @mongodb.driver.manual tutorial/query-documents/ Find
*/
FindPublisher find(Class clazz);
/**
* Finds all documents in the collection.
*
* @param filter the query filter
* @return the fluent find interface
* @mongodb.driver.manual tutorial/query-documents/ Find
*/
FindPublisher find(Bson filter);
/**
* Finds all documents in the collection.
*
* @param filter the query filter
* @param clazz the class to decode each document into
* @param the target document type of the iterable.
* @return the fluent find interface
* @mongodb.driver.manual tutorial/query-documents/ Find
*/
FindPublisher find(Bson filter, Class clazz);
/**
* Finds all documents in the collection.
*
* @param clientSession the client session with which to associate this operation
* @return the fluent find interface
* @mongodb.driver.manual tutorial/query-documents/ Find
* @mongodb.server.release 3.6
* @since 1.7
*/
FindPublisher find(ClientSession clientSession);
/**
* Finds all documents in the collection.
*
* @param clientSession the client session with which to associate this operation
* @param clazz the class to decode each document into
* @param the target document type of the iterable.
* @return the fluent find interface
* @mongodb.driver.manual tutorial/query-documents/ Find
* @mongodb.server.release 3.6
* @since 1.7
*/
FindPublisher find(ClientSession clientSession, Class clazz);
/**
* Finds all documents in the collection.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter
* @return the fluent find interface
* @mongodb.driver.manual tutorial/query-documents/ Find
* @mongodb.server.release 3.6
* @since 1.7
*/
FindPublisher find(ClientSession clientSession, Bson filter);
/**
* Finds all documents in the collection.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter
* @param clazz the class to decode each document into
* @param the target document type of the iterable.
* @return the fluent find interface
* @mongodb.driver.manual tutorial/query-documents/ Find
* @mongodb.server.release 3.6
* @since 1.7
*/
FindPublisher find(ClientSession clientSession, Bson filter, Class clazz);
/**
* Aggregates documents according to the specified aggregation pipeline.
*
* @param pipeline the aggregate pipeline
* @return a publisher containing the result of the aggregation operation
* @mongodb.driver.manual aggregation/ Aggregation
*/
AggregatePublisher aggregate(List extends Bson> pipeline);
/**
* Aggregates documents according to the specified aggregation pipeline.
*
* @param pipeline the aggregate pipeline
* @param clazz the class to decode each document into
* @param the target document type of the iterable.
* @return a publisher containing the result of the aggregation operation
* @mongodb.driver.manual aggregation/ Aggregation
*/
AggregatePublisher aggregate(List extends Bson> pipeline, Class clazz);
/**
* Aggregates documents according to the specified aggregation pipeline.
*
* @param clientSession the client session with which to associate this operation
* @param pipeline the aggregate pipeline
* @return a publisher containing the result of the aggregation operation
* @mongodb.driver.manual aggregation/ Aggregation
* @mongodb.server.release 3.6
* @since 1.7
*/
AggregatePublisher aggregate(ClientSession clientSession, List extends Bson> pipeline);
/**
* Aggregates documents according to the specified aggregation pipeline.
*
* @param clientSession the client session with which to associate this operation
* @param pipeline the aggregate pipeline
* @param clazz the class to decode each document into
* @param the target document type of the iterable.
* @return a publisher containing the result of the aggregation operation
* @mongodb.driver.manual aggregation/ Aggregation
* @mongodb.server.release 3.6
* @since 1.7
*/
AggregatePublisher aggregate(ClientSession clientSession, List extends Bson> pipeline, Class clazz);
/**
* Creates a change stream for this collection.
*
* @return the change stream iterable
* @mongodb.driver.manual reference/operator/aggregation/changeStream $changeStream
* @mongodb.server.release 3.6
* @since 1.7
*/
ChangeStreamPublisher watch();
/**
* Creates a change stream for this collection.
*
* @param resultClass the class to decode each document into
* @param the target document type of the iterable.
* @return the change stream iterable
* @mongodb.driver.manual reference/operator/aggregation/changeStream $changeStream
* @mongodb.server.release 3.6
* @since 1.7
*/
ChangeStreamPublisher watch(Class resultClass);
/**
* Creates a change stream for this collection.
*
* @param pipeline the aggregation pipeline to apply to the change stream
* @return the change stream iterable
* @mongodb.driver.manual reference/operator/aggregation/changeStream $changeStream
* @since 1.6
*/
ChangeStreamPublisher watch(List extends Bson> pipeline);
/**
* Creates a change stream for this collection.
*
* @param pipeline the aggregation pipeline to apply to the change stream
* @param resultClass the class to decode each document into
* @param the target document type of the iterable.
* @return the change stream iterable
* @mongodb.driver.manual reference/operator/aggregation/changeStream $changeStream
* @since 1.6
*/
ChangeStreamPublisher watch(List extends Bson> pipeline, Class resultClass);
/**
* Creates a change stream for this collection.
*
* @param clientSession the client session with which to associate this operation
* @return the change stream iterable
* @mongodb.driver.manual reference/operator/aggregation/changeStream $changeStream
* @mongodb.server.release 3.6
* @since 1.7
*/
ChangeStreamPublisher watch(ClientSession clientSession);
/**
* Creates a change stream for this collection.
*
* @param clientSession the client session with which to associate this operation
* @param resultClass the class to decode each document into
* @param the target document type of the iterable.
* @return the change stream iterable
* @mongodb.driver.manual reference/operator/aggregation/changeStream $changeStream
* @mongodb.server.release 3.6
* @since 1.7
*/
ChangeStreamPublisher watch(ClientSession clientSession, Class resultClass);
/**
* Creates a change stream for this collection.
*
* @param clientSession the client session with which to associate this operation
* @param pipeline the aggregation pipeline to apply to the change stream
* @return the change stream iterable
* @mongodb.driver.manual reference/operator/aggregation/changeStream $changeStream
* @mongodb.server.release 3.6
* @since 1.7
*/
ChangeStreamPublisher watch(ClientSession clientSession, List extends Bson> pipeline);
/**
* Creates a change stream for this collection.
*
* @param clientSession the client session with which to associate this operation
* @param pipeline the aggregation pipeline to apply to the change stream
* @param resultClass the class to decode each document into
* @param the target document type of the iterable.
* @return the change stream iterable
* @mongodb.driver.manual reference/operator/aggregation/changeStream $changeStream
* @mongodb.server.release 3.6
* @since 1.7
*/
ChangeStreamPublisher watch(ClientSession clientSession, List extends Bson> pipeline, Class resultClass);
/**
* Aggregates documents according to the specified map-reduce function.
*
* @param mapFunction A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.
* @param reduceFunction A JavaScript function that "reduces" to a single object all the values associated with a particular key.
* @return an publisher containing the result of the map-reduce operation
* @mongodb.driver.manual reference/command/mapReduce/ map-reduce
* @deprecated Superseded by aggregate
*/
@Deprecated
MapReducePublisher mapReduce(String mapFunction, String reduceFunction);
/**
* Aggregates documents according to the specified map-reduce function.
*
* @param mapFunction A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.
* @param reduceFunction A JavaScript function that "reduces" to a single object all the values associated with a particular key.
* @param clazz the class to decode each resulting document into.
* @param the target document type of the iterable.
* @return a publisher containing the result of the map-reduce operation
* @mongodb.driver.manual reference/command/mapReduce/ map-reduce
* @deprecated Superseded by aggregate
*/
@Deprecated
MapReducePublisher mapReduce(String mapFunction, String reduceFunction, Class clazz);
/**
* Aggregates documents according to the specified map-reduce function.
*
* @param clientSession the client session with which to associate this operation
* @param mapFunction A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.
* @param reduceFunction A JavaScript function that "reduces" to a single object all the values associated with a particular key.
* @return an publisher containing the result of the map-reduce operation
* @mongodb.driver.manual reference/command/mapReduce/ map-reduce
* @mongodb.server.release 3.6
* @since 1.7
* @deprecated Superseded by aggregate
*/
@Deprecated
MapReducePublisher mapReduce(ClientSession clientSession, String mapFunction, String reduceFunction);
/**
* Aggregates documents according to the specified map-reduce function.
*
* @param clientSession the client session with which to associate this operation
* @param mapFunction A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.
* @param reduceFunction A JavaScript function that "reduces" to a single object all the values associated with a particular key.
* @param clazz the class to decode each resulting document into.
* @param the target document type of the iterable.
* @return a publisher containing the result of the map-reduce operation
* @mongodb.driver.manual reference/command/mapReduce/ map-reduce
* @mongodb.server.release 3.6
* @since 1.7
* @deprecated Superseded by aggregate
*/
@Deprecated
MapReducePublisher mapReduce(ClientSession clientSession, String mapFunction, String reduceFunction,
Class clazz);
/**
* Executes a mix of inserts, updates, replaces, and deletes.
*
* @param requests the writes to execute
* @return a publisher with a single element the BulkWriteResult
*/
Publisher bulkWrite(List extends WriteModel extends TDocument>> requests);
/**
* Executes a mix of inserts, updates, replaces, and deletes.
*
* @param requests the writes to execute
* @param options the options to apply to the bulk write operation
* @return a publisher with a single element the BulkWriteResult
*/
Publisher bulkWrite(List extends WriteModel extends TDocument>> requests, BulkWriteOptions options);
/**
* Executes a mix of inserts, updates, replaces, and deletes.
*
* @param clientSession the client session with which to associate this operation
* @param requests the writes to execute
* @return a publisher with a single element the BulkWriteResult
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher bulkWrite(ClientSession clientSession, List extends WriteModel extends TDocument>> requests);
/**
* Executes a mix of inserts, updates, replaces, and deletes.
*
* @param clientSession the client session with which to associate this operation
* @param requests the writes to execute
* @param options the options to apply to the bulk write operation
* @return a publisher with a single element the BulkWriteResult
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher bulkWrite(ClientSession clientSession, List extends WriteModel extends TDocument>> requests,
BulkWriteOptions options);
/**
* Inserts the provided document. If the document is missing an identifier, the driver should generate one.
*
* @param document the document to insert
* @return a publisher with a single element with the InsertOneResult or with either a
* com.mongodb.DuplicateKeyException or com.mongodb.MongoException
*/
Publisher insertOne(TDocument document);
/**
* Inserts the provided document. If the document is missing an identifier, the driver should generate one.
*
* @param document the document to insert
* @param options the options to apply to the operation
* @return a publisher with a single element with the InsertOneResult or with either a
* com.mongodb.DuplicateKeyException or com.mongodb.MongoException
* @since 1.2
*/
Publisher insertOne(TDocument document, InsertOneOptions options);
/**
* Inserts the provided document. If the document is missing an identifier, the driver should generate one.
*
* @param clientSession the client session with which to associate this operation
* @param document the document to insert
* @return a publisher with a single element with the InsertOneResult or with either a
* com.mongodb.DuplicateKeyException or com.mongodb.MongoException
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher insertOne(ClientSession clientSession, TDocument document);
/**
* Inserts the provided document. If the document is missing an identifier, the driver should generate one.
*
* @param clientSession the client session with which to associate this operation
* @param document the document to insert
* @param options the options to apply to the operation
* @return a publisher with a single element with the InsertOneResult or with either a
* com.mongodb.DuplicateKeyException or com.mongodb.MongoException
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher insertOne(ClientSession clientSession, TDocument document, InsertOneOptions options);
/**
* Inserts a batch of documents.
*
* @param documents the documents to insert
* @return a publisher with a single element with the InsertManyResult or with either a
* com.mongodb.DuplicateKeyException or com.mongodb.MongoException
*/
Publisher insertMany(List extends TDocument> documents);
/**
* Inserts a batch of documents.
*
* @param documents the documents to insert
* @param options the options to apply to the operation
* @return a publisher with a single element with the InsertManyResult or with either a
* com.mongodb.DuplicateKeyException or com.mongodb.MongoException
*/
Publisher insertMany(List extends TDocument> documents, InsertManyOptions options);
/**
* Inserts a batch of documents.
*
* @param clientSession the client session with which to associate this operation
* @param documents the documents to insert
* @return a publisher with a single element with the InsertManyResult or with either a
* com.mongodb.DuplicateKeyException or com.mongodb.MongoException
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher insertMany(ClientSession clientSession, List extends TDocument> documents);
/**
* Inserts a batch of documents.
*
* @param clientSession the client session with which to associate this operation
* @param documents the documents to insert
* @param options the options to apply to the operation
* @return a publisher with a single element with the InsertManyResult or with either a
* com.mongodb.DuplicateKeyException or com.mongodb.MongoException
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher insertMany(ClientSession clientSession, List extends TDocument> documents, InsertManyOptions options);
/**
* Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not
* modified.
*
* @param filter the query filter to apply the delete operation
* @return a publisher with a single element the DeleteResult or with an com.mongodb.MongoException
*/
Publisher deleteOne(Bson filter);
/**
* Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not
* modified.
*
* @param filter the query filter to apply the delete operation
* @param options the options to apply to the delete operation
* @return a publisher with a single element the DeleteResult or with an com.mongodb.MongoException
* @since 1.5
*/
Publisher deleteOne(Bson filter, DeleteOptions options);
/**
* Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not
* modified.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter to apply the delete operation
* @return a publisher with a single element the DeleteResult or with an com.mongodb.MongoException
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher deleteOne(ClientSession clientSession, Bson filter);
/**
* Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not
* modified.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter to apply the delete operation
* @param options the options to apply to the delete operation
* @return a publisher with a single element the DeleteResult or with an com.mongodb.MongoException
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher deleteOne(ClientSession clientSession, Bson filter, DeleteOptions options);
/**
* Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
*
* @param filter the query filter to apply the delete operation
* @return a publisher with a single element the DeleteResult or with an com.mongodb.MongoException
*/
Publisher deleteMany(Bson filter);
/**
* Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
*
* @param filter the query filter to apply the delete operation
* @param options the options to apply to the delete operation
* @return a publisher with a single element the DeleteResult or with an com.mongodb.MongoException
* @since 1.5
*/
Publisher deleteMany(Bson filter, DeleteOptions options);
/**
* Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter to apply the delete operation
* @return a publisher with a single element the DeleteResult or with an com.mongodb.MongoException
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher deleteMany(ClientSession clientSession, Bson filter);
/**
* Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter to apply the delete operation
* @param options the options to apply to the delete operation
* @return a publisher with a single element the DeleteResult or with an com.mongodb.MongoException
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher deleteMany(ClientSession clientSession, Bson filter, DeleteOptions options);
/**
* Replace a document in the collection according to the specified arguments.
*
* @param filter the query filter to apply the replace operation
* @param replacement the replacement document
* @return a publisher with a single element the UpdateResult
* @mongodb.driver.manual tutorial/modify-documents/#replace-the-document Replace
*/
Publisher replaceOne(Bson filter, TDocument replacement);
/**
* Replace a document in the collection according to the specified arguments.
*
* @param filter the query filter to apply the replace operation
* @param replacement the replacement document
* @param options the options to apply to the replace operation
* @return a publisher with a single element the UpdateResult
* @mongodb.driver.manual tutorial/modify-documents/#replace-the-document Replace
* @since 1.8
*/
Publisher replaceOne(Bson filter, TDocument replacement, ReplaceOptions options);
/**
* Replace a document in the collection according to the specified arguments.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter to apply the replace operation
* @param replacement the replacement document
* @return a publisher with a single element the UpdateResult
* @mongodb.driver.manual tutorial/modify-documents/#replace-the-document Replace
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher replaceOne(ClientSession clientSession, Bson filter, TDocument replacement);
/**
* Replace a document in the collection according to the specified arguments.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter to apply the replace operation
* @param replacement the replacement document
* @param options the options to apply to the replace operation
* @return a publisher with a single element the UpdateResult
* @mongodb.driver.manual tutorial/modify-documents/#replace-the-document Replace
* @mongodb.server.release 3.6
* @since 1.8
*/
Publisher replaceOne(ClientSession clientSession, Bson filter, TDocument replacement, ReplaceOptions options);
/**
* Update a single document in the collection according to the specified arguments.
*
* @param filter a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to apply must include only update operators.
* @return a publisher with a single element the UpdateResult
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
*/
Publisher updateOne(Bson filter, Bson update);
/**
* Update a single document in the collection according to the specified arguments.
*
* @param filter a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to apply must include only update operators.
* @param options the options to apply to the update operation
* @return a publisher with a single element the UpdateResult
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
*/
Publisher updateOne(Bson filter, Bson update, UpdateOptions options);
/**
* Update a single document in the collection according to the specified arguments.
*
* @param clientSession the client session with which to associate this operation
* @param filter a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to apply must include only update operators.
* @return a publisher with a single element the UpdateResult
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher updateOne(ClientSession clientSession, Bson filter, Bson update);
/**
* Update a single document in the collection according to the specified arguments.
*
* @param clientSession the client session with which to associate this operation
* @param filter a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to apply must include only update operators.
* @param options the options to apply to the update operation
* @return a publisher with a single element the UpdateResult
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher updateOne(ClientSession clientSession, Bson filter, Bson update, UpdateOptions options);
/**
* Update a single document in the collection according to the specified arguments.
*
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* @param filter a document describing the query filter, which may not be null.
* @param update a pipeline describing the update, which may not be null.
* @return a publisher with a single element the UpdateResult
* @since 1.12
* @mongodb.server.release 4.2
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
*/
Publisher updateOne(Bson filter, List extends Bson> update);
/**
* Update a single document in the collection according to the specified arguments.
*
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* @param filter a document describing the query filter, which may not be null.
* @param update a pipeline describing the update, which may not be null.
* @param options the options to apply to the update operation
* @return a publisher with a single element the UpdateResult
* @since 1.12
* @mongodb.server.release 4.2
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
*/
Publisher updateOne(Bson filter, List extends Bson> update, UpdateOptions options);
/**
* Update a single document in the collection according to the specified arguments.
*
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* @param clientSession the client session with which to associate this operation
* @param filter a document describing the query filter, which may not be null.
* @param update a pipeline describing the update, which may not be null.
* @return a publisher with a single element the UpdateResult
* @since 1.12
* @mongodb.server.release 4.2
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
*/
Publisher updateOne(ClientSession clientSession, Bson filter, List extends Bson> update);
/**
* Update a single document in the collection according to the specified arguments.
*
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* @param clientSession the client session with which to associate this operation
* @param filter a document describing the query filter, which may not be null.
* @param update a pipeline describing the update, which may not be null.
* @param options the options to apply to the update operation
* @return a publisher with a single element the UpdateResult
* @since 1.12
* @mongodb.server.release 4.2
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
*/
Publisher updateOne(ClientSession clientSession, Bson filter, List extends Bson> update, UpdateOptions options);
/**
* Update all documents in the collection according to the specified arguments.
*
* @param filter a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to apply must include only update operators.
* @return a publisher with a single element the UpdateResult
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
*/
Publisher updateMany(Bson filter, Bson update);
/**
* Update all documents in the collection according to the specified arguments.
*
* @param filter a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to apply must include only update operators.
* @param options the options to apply to the update operation
* @return a publisher with a single element the UpdateResult
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
*/
Publisher updateMany(Bson filter, Bson update, UpdateOptions options);
/**
* Update all documents in the collection according to the specified arguments.
*
* @param clientSession the client session with which to associate this operation
* @param filter a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to apply must include only update operators.
* @return a publisher with a single element the UpdateResult
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher updateMany(ClientSession clientSession, Bson filter, Bson update);
/**
* Update all documents in the collection according to the specified arguments.
*
* @param clientSession the client session with which to associate this operation
* @param filter a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to apply must include only update operators.
* @param options the options to apply to the update operation
* @return a publisher with a single element the UpdateResult
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher updateMany(ClientSession clientSession, Bson filter, Bson update, UpdateOptions options);
/**
* Update all documents in the collection according to the specified arguments.
*
* @param filter a document describing the query filter, which may not be null.
* @param update a pipeline describing the update, which may not be null.
* @return a publisher with a single element the UpdateResult
* @since 1.12
* @mongodb.server.release 4.2
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
*/
Publisher updateMany(Bson filter, List extends Bson> update);
/**
* Update all documents in the collection according to the specified arguments.
*
* @param filter a document describing the query filter, which may not be null.
* @param update a pipeline describing the update, which may not be null.
* @param options the options to apply to the update operation
* @return a publisher with a single element the UpdateResult
* @since 1.12
* @mongodb.server.release 4.2
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
*/
Publisher updateMany(Bson filter, List extends Bson> update, UpdateOptions options);
/**
* Update all documents in the collection according to the specified arguments.
*
* @param clientSession the client session with which to associate this operation
* @param filter a document describing the query filter, which may not be null.
* @param update a pipeline describing the update, which may not be null.
* @return a publisher with a single element the UpdateResult
* @since 1.12
* @mongodb.server.release 4.2
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
*/
Publisher updateMany(ClientSession clientSession, Bson filter, List extends Bson> update);
/**
* Update all documents in the collection according to the specified arguments.
*
* @param clientSession the client session with which to associate this operation
* @param filter a document describing the query filter, which may not be null.
* @param update a pipeline describing the update, which may not be null.
* @param options the options to apply to the update operation
* @return a publisher with a single element the UpdateResult
* @since 1.12
* @mongodb.server.release 4.2
* @mongodb.driver.manual tutorial/modify-documents/ Updates
* @mongodb.driver.manual reference/operator/update/ Update Operators
*/
Publisher updateMany(ClientSession clientSession, Bson filter, List extends Bson> update, UpdateOptions options);
/**
* Atomically find a document and remove it.
*
* @param filter the query filter to find the document with
* @return a publisher with a single element the document that was removed. If no documents matched the query filter, then null will be
* returned
*/
Publisher findOneAndDelete(Bson filter);
/**
* Atomically find a document and remove it.
*
* @param filter the query filter to find the document with
* @param options the options to apply to the operation
* @return a publisher with a single element the document that was removed. If no documents matched the query filter, then null will be
* returned
*/
Publisher findOneAndDelete(Bson filter, FindOneAndDeleteOptions options);
/**
* Atomically find a document and remove it.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter to find the document with
* @return a publisher with a single element the document that was removed. If no documents matched the query filter, then null will be
* returned
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher findOneAndDelete(ClientSession clientSession, Bson filter);
/**
* Atomically find a document and remove it.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter to find the document with
* @param options the options to apply to the operation
* @return a publisher with a single element the document that was removed. If no documents matched the query filter, then null will be
* returned
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher findOneAndDelete(ClientSession clientSession, Bson filter, FindOneAndDeleteOptions options);
/**
* Atomically find a document and replace it.
*
* @param filter the query filter to apply the replace operation
* @param replacement the replacement document
* @return a publisher with a single element the document that was replaced. Depending on the value of the {@code 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
*/
Publisher findOneAndReplace(Bson filter, TDocument replacement);
/**
* Atomically find a document and replace it.
*
* @param filter the query filter to apply the replace operation
* @param replacement the replacement document
* @param options the options to apply to the operation
* @return a publisher with a single element the document that was replaced. Depending on the value of the {@code 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
*/
Publisher findOneAndReplace(Bson filter, TDocument replacement, FindOneAndReplaceOptions options);
/**
* Atomically find a document and replace it.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter to apply the replace operation
* @param replacement the replacement document
* @return a publisher with a single element the document that was replaced. Depending on the value of the {@code 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
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher findOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement);
/**
* Atomically find a document and replace it.
*
* @param clientSession the client session with which to associate this operation
* @param filter the query filter to apply the replace operation
* @param replacement the replacement document
* @param options the options to apply to the operation
* @return a publisher with a single element the document that was replaced. Depending on the value of the {@code 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
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher findOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement,
FindOneAndReplaceOptions options);
/**
* Atomically find a document and update it.
*
* @param filter a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to apply must include only update operators.
* @return a publisher with a single element the document that was updated before the update was applied. If no documents matched the
* query filter, then null will be returned
*/
Publisher findOneAndUpdate(Bson filter, Bson update);
/**
* Atomically find a document and update it.
*
* @param filter a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to apply must include only update operators.
* @param options the options to apply to the operation
* @return a publisher with a single element the document that was updated. Depending on the value of the {@code 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
*/
Publisher findOneAndUpdate(Bson filter, Bson update, FindOneAndUpdateOptions options);
/**
* Atomically find a document and update it.
*
* @param clientSession the client session with which to associate this operation
* @param filter a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to apply must include only update operators.
* @return a publisher with a single element the document that was updated before the update was applied. If no documents matched the
* query filter, then null will be returned
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update);
/**
* Atomically find a document and update it.
*
* @param clientSession the client session with which to associate this operation
* @param filter a document describing the query filter, which may not be null.
* @param update a document describing the update, which may not be null. The update to apply must include only update operators.
* @param options the options to apply to the operation
* @return a publisher with a single element the document that was updated. Depending on the value of the {@code 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
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update, FindOneAndUpdateOptions options);
/**
* Atomically find a document and update it.
*
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* @param filter a document describing the query filter, which may not be null.
* @param update a pipeline describing the update, which may not be null.
* @return a publisher with a single element the document that was updated. Depending on the value of the {@code returnOriginal}
* property, this will either be the document as it was before the update or as it is after the update. If no documents matched the
* query filter, then null will be returned
* @since 1.12
* @mongodb.server.release 4.2
*/
Publisher findOneAndUpdate(Bson filter, List extends Bson> update);
/**
* Atomically find a document and update it.
*
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* @param filter a document describing the query filter, which may not be null.
* @param update a pipeline describing the update, which may not be null.
* @param options the options to apply to the operation
* @return a publisher with a single element the document that was updated. Depending on the value of the {@code returnOriginal}
* property, this will either be the document as it was before the update or as it is after the update. If no documents matched the
* query filter, then null will be returned
* @since 1.12
* @mongodb.server.release 4.2
*/
Publisher findOneAndUpdate(Bson filter, List extends Bson> update, FindOneAndUpdateOptions options);
/**
* Atomically find a document and update it.
*
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* @param clientSession the client session with which to associate this operation
* @param filter a document describing the query filter, which may not be null.
* @param update a pipeline describing the update, which may not be null.
* @return a publisher with a single element the document that was updated. Depending on the value of the {@code returnOriginal}
* property, this will either be the document as it was before the update or as it is after the update. If no documents matched the
* query filter, then null will be returned
* @since 1.12
* @mongodb.server.release 4.2
*/
Publisher findOneAndUpdate(ClientSession clientSession, Bson filter, List extends Bson> update);
/**
* Atomically find a document and update it.
*
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* @param clientSession the client session with which to associate this operation
* @param filter a document describing the query filter, which may not be null.
* @param update a pipeline describing the update, which may not be null.
* @param options the options to apply to the operation
* @return a publisher with a single element the document that was updated. Depending on the value of the {@code returnOriginal}
* property, this will either be the document as it was before the update or as it is after the update. If no documents matched the
* query filter, then null will be returned
* @since 1.12
* @mongodb.server.release 4.2
*/
Publisher findOneAndUpdate(ClientSession clientSession, Bson filter, List extends Bson> update,
FindOneAndUpdateOptions options);
/**
* Drops this collection from the Database.
*
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/drop/ Drop Collection
*/
Publisher drop();
/**
* Drops this collection from the Database.
*
* @param clientSession the client session with which to associate this operation
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/drop/ Drop Collection
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher drop(ClientSession clientSession);
/**
* Drops this collection from the Database.
*
* @param dropCollectionOptions various options for dropping the collection
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/drop/ Drop Collection
* @since 4.7
* @mongodb.server.release 6.0
*/
Publisher drop(DropCollectionOptions dropCollectionOptions);
/**
* Drops this collection from the Database.
*
* @param clientSession the client session with which to associate this operation
* @param dropCollectionOptions various options for dropping the collection
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/drop/ Drop Collection
* @since 4.7
* @mongodb.server.release 6.0
*/
Publisher drop(ClientSession clientSession, DropCollectionOptions dropCollectionOptions);
/**
* Create an Atlas Search index for the collection.
*
* @param indexName the name of the search index to create.
* @param definition Atlas Search index mapping definition.
* @return a {@link Publisher} with search index name.
* @mongodb.server.release 6.0
* @mongodb.driver.manual reference/command/createSearchIndexes/ Create Search indexes
* @since 4.11
*/
Publisher createSearchIndex(String indexName, Bson definition);
/**
* Create an Atlas Search index with {@code "default"} name for the collection.
*
* @param definition Atlas Search index mapping definition.
* @return a {@link Publisher} with search index name.
* @mongodb.server.release 6.0
* @mongodb.driver.manual reference/command/createSearchIndexes/ Create Search indexes
* @since 4.11
*/
Publisher createSearchIndex(Bson definition);
/**
* Create one or more Atlas Search indexes for the collection.
*
* The name can be omitted for a single index, in which case a name will be {@code "default"}.
*
*
* @param searchIndexModels the search index models.
* @return a {@link Publisher} with the search index names in the order specified by the given list {@link SearchIndexModel}s.
* @mongodb.server.release 6.0
* @mongodb.driver.manual reference/command/createSearchIndexes/ Create Search indexes
* @since 4.11
*/
Publisher createSearchIndexes(List searchIndexModels);
/**
* Update an Atlas Search index in the collection.
*
* @param indexName the name of the search index to update.
* @param definition Atlas Search index mapping definition.
* @return an empty publisher that indicates when the operation has completed.
* @mongodb.server.release 6.0
* @mongodb.driver.manual reference/command/updateSearchIndex/ Update Search index
* @since 4.11
*/
Publisher updateSearchIndex(String indexName, Bson definition);
/**
* Drop an Atlas Search index given its name.
*
* @param indexName the name of the search index to drop.
* @return an empty publisher that indicates when the operation has completed.
* @mongodb.server.release 6.0
* @mongodb.driver.manual reference/command/dropSearchIndex/ Drop Search index
* @since 4.11
*/
Publisher dropSearchIndex(String indexName);
/**
* Get all Atlas Search indexes in this collection.
*
* @return the fluent list search indexes interface.
* @since 4.11
* @mongodb.server.release 6.0
*/
ListSearchIndexesPublisher listSearchIndexes();
/**
* Get all Atlas Search indexes in this collection.
*
* @param resultClass the class to decode each document into.
* @param the target document type of the iterable.
* @return the fluent list search indexes interface.
* @since 4.11
* @mongodb.server.release 6.0
*/
ListSearchIndexesPublisher listSearchIndexes(Class resultClass);
/**
* Creates an index.
*
* @param key an object describing the index key(s), which may not be null.
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/method/db.collection.ensureIndex Ensure Index
*/
Publisher createIndex(Bson key);
/**
* Creates an index.
*
* @param key an object describing the index key(s), which may not be null.
* @param options the options for the index
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/method/db.collection.ensureIndex Ensure Index
*/
Publisher createIndex(Bson key, IndexOptions options);
/**
* Creates an index.
*
* @param clientSession the client session with which to associate this operation
* @param key an object describing the index key(s), which may not be null.
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/method/db.collection.ensureIndex Ensure Index
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher createIndex(ClientSession clientSession, Bson key);
/**
* Creates an index.
*
* @param clientSession the client session with which to associate this operation
* @param key an object describing the index key(s), which may not be null.
* @param options the options for the index
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/method/db.collection.ensureIndex Ensure Index
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher createIndex(ClientSession clientSession, Bson key, IndexOptions options);
/**
* Create multiple indexes.
*
* @param indexes the list of indexes
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/createIndexes Create indexes
*/
Publisher createIndexes(List indexes);
/**
* Create multiple indexes.
*
* @param indexes the list of indexes
* @param createIndexOptions options to use when creating indexes
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/createIndexes Create indexes
* @since 1.7
*/
Publisher createIndexes(List indexes, CreateIndexOptions createIndexOptions);
/**
* Create multiple indexes.
*
* @param clientSession the client session with which to associate this operation
* @param indexes the list of indexes
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/createIndexes Create indexes
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher createIndexes(ClientSession clientSession, List indexes);
/**
* Create multiple indexes.
*
* @param clientSession the client session with which to associate this operation
* @param indexes the list of indexes
* @param createIndexOptions options to use when creating indexes
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/createIndexes Create indexes
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher createIndexes(ClientSession clientSession, List indexes, CreateIndexOptions createIndexOptions);
/**
* Get all the indexes in this collection.
*
* @return the fluent list indexes interface
* @mongodb.driver.manual reference/command/listIndexes/ listIndexes
*/
ListIndexesPublisher listIndexes();
/**
* Get all the indexes in this collection.
*
* @param clazz the class to decode each document into
* @param the target document type of the iterable.
* @return the fluent list indexes interface
* @mongodb.driver.manual reference/command/listIndexes/ listIndexes
*/
ListIndexesPublisher listIndexes(Class clazz);
/**
* Get all the indexes in this collection.
*
* @param clientSession the client session with which to associate this operation
* @return the fluent list indexes interface
* @mongodb.driver.manual reference/command/listIndexes/ listIndexes
* @mongodb.server.release 3.6
* @since 1.7
*/
ListIndexesPublisher listIndexes(ClientSession clientSession);
/**
* Get all the indexes in this collection.
*
* @param clientSession the client session with which to associate this operation
* @param clazz the class to decode each document into
* @param the target document type of the iterable.
* @return the fluent list indexes interface
* @mongodb.driver.manual reference/command/listIndexes/ listIndexes
* @mongodb.server.release 3.6
* @since 1.7
*/
ListIndexesPublisher listIndexes(ClientSession clientSession, Class clazz);
/**
* Drops the given index.
*
* @param indexName the name of the index to remove
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/dropIndexes/ Drop Indexes
*/
Publisher dropIndex(String indexName);
/**
* Drops the index given the keys used to create it.
*
* @param keys the keys of the index to remove
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/dropIndexes/ Drop indexes
*/
Publisher dropIndex(Bson keys);
/**
* Drops the given index.
*
* @param indexName the name of the index to remove
* @param dropIndexOptions options to use when dropping indexes
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/dropIndexes/ Drop Indexes
* @since 1.7
*/
Publisher dropIndex(String indexName, DropIndexOptions dropIndexOptions);
/**
* Drops the index given the keys used to create it.
*
* @param keys the keys of the index to remove
* @param dropIndexOptions options to use when dropping indexes
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/dropIndexes/ Drop indexes
* @since 1.7
*/
Publisher dropIndex(Bson keys, DropIndexOptions dropIndexOptions);
/**
* Drops the given index.
*
* @param clientSession the client session with which to associate this operation
* @param indexName the name of the index to remove
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/dropIndexes/ Drop Indexes
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher dropIndex(ClientSession clientSession, String indexName);
/**
* Drops the index given the keys used to create it.
*
* @param clientSession the client session with which to associate this operation
* @param keys the keys of the index to remove
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/dropIndexes/ Drop indexes
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher dropIndex(ClientSession clientSession, Bson keys);
/**
* Drops the given index.
*
* @param clientSession the client session with which to associate this operation
* @param indexName the name of the index to remove
* @param dropIndexOptions options to use when dropping indexes
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/dropIndexes/ Drop Indexes
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher dropIndex(ClientSession clientSession, String indexName, DropIndexOptions dropIndexOptions);
/**
* Drops the index given the keys used to create it.
*
* @param clientSession the client session with which to associate this operation
* @param keys the keys of the index to remove
* @param dropIndexOptions options to use when dropping indexes
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/dropIndexes/ Drop indexes
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher dropIndex(ClientSession clientSession, Bson keys, DropIndexOptions dropIndexOptions);
/**
* Drop all the indexes on this collection, except for the default on _id.
*
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/dropIndexes/ Drop Indexes
*/
Publisher dropIndexes();
/**
* Drop all the indexes on this collection, except for the default on _id.
*
* @param dropIndexOptions options to use when dropping indexes
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/dropIndexes/ Drop Indexes
* @since 1.7
*/
Publisher dropIndexes(DropIndexOptions dropIndexOptions);
/**
* Drop all the indexes on this collection, except for the default on _id.
*
* @param clientSession the client session with which to associate this operation
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/dropIndexes/ Drop Indexes
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher dropIndexes(ClientSession clientSession);
/**
* Drop all the indexes on this collection, except for the default on _id.
*
* @param clientSession the client session with which to associate this operation
* @param dropIndexOptions options to use when dropping indexes
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/command/dropIndexes/ Drop Indexes
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher dropIndexes(ClientSession clientSession, DropIndexOptions dropIndexOptions);
/**
* Rename the collection with oldCollectionName to the newCollectionName.
*
* @param newCollectionNamespace the namespace the collection will be renamed to
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/commands/renameCollection Rename collection
*/
Publisher renameCollection(MongoNamespace newCollectionNamespace);
/**
* Rename the collection with oldCollectionName to the newCollectionName.
*
* @param newCollectionNamespace the name the collection will be renamed to
* @param options the options for renaming a collection
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/commands/renameCollection Rename collection
*/
Publisher renameCollection(MongoNamespace newCollectionNamespace, RenameCollectionOptions options);
/**
* Rename the collection with oldCollectionName to the newCollectionName.
*
* @param clientSession the client session with which to associate this operation
* @param newCollectionNamespace the namespace the collection will be renamed to
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/commands/renameCollection Rename collection
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace);
/**
* Rename the collection with oldCollectionName to the newCollectionName.
*
* @param clientSession the client session with which to associate this operation
* @param newCollectionNamespace the name the collection will be renamed to
* @param options the options for renaming a collection
* @return an empty publisher that indicates when the operation has completed
* @mongodb.driver.manual reference/commands/renameCollection Rename collection
* @mongodb.server.release 3.6
* @since 1.7
*/
Publisher renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace,
RenameCollectionOptions options);
}