TDocument
- The type that this collection will encode documents from and decode documents to.@ThreadSafe public interface MongoCollection<TDocument>
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
.
Modifier and Type | Method | Description |
---|---|---|
AggregateIterable<TDocument> |
aggregate(ClientSession clientSession,
List<? extends Bson> pipeline) |
Aggregates documents according to the specified aggregation pipeline.
|
<TResult> AggregateIterable<TResult> |
aggregate(ClientSession clientSession,
List<? extends Bson> pipeline,
Class<TResult> resultClass) |
Aggregates documents according to the specified aggregation pipeline.
|
AggregateIterable<TDocument> |
aggregate(List<? extends Bson> pipeline) |
Aggregates documents according to the specified aggregation pipeline.
|
<TResult> AggregateIterable<TResult> |
aggregate(List<? extends Bson> pipeline,
Class<TResult> resultClass) |
Aggregates documents according to the specified aggregation pipeline.
|
void |
bulkWrite(ClientSession clientSession,
List<? extends WriteModel<? extends TDocument>> requests,
SingleResultCallback<BulkWriteResult> callback) |
Executes a mix of inserts, updates, replaces, and deletes.
|
void |
bulkWrite(ClientSession clientSession,
List<? extends WriteModel<? extends TDocument>> requests,
BulkWriteOptions options,
SingleResultCallback<BulkWriteResult> callback) |
Executes a mix of inserts, updates, replaces, and deletes.
|
void |
bulkWrite(List<? extends WriteModel<? extends TDocument>> requests,
SingleResultCallback<BulkWriteResult> callback) |
Executes a mix of inserts, updates, replaces, and deletes.
|
void |
bulkWrite(List<? extends WriteModel<? extends TDocument>> requests,
BulkWriteOptions options,
SingleResultCallback<BulkWriteResult> callback) |
Executes a mix of inserts, updates, replaces, and deletes.
|
void |
count(SingleResultCallback<Long> callback) |
Counts the number of documents in the collection.
|
void |
count(ClientSession clientSession,
SingleResultCallback<Long> callback) |
Counts the number of documents in the collection.
|
void |
count(ClientSession clientSession,
Bson filter,
SingleResultCallback<Long> callback) |
Counts the number of documents in the collection according to the given options.
|
void |
count(ClientSession clientSession,
Bson filter,
CountOptions options,
SingleResultCallback<Long> callback) |
Counts the number of documents in the collection according to the given options.
|
void |
count(Bson filter,
SingleResultCallback<Long> callback) |
Counts the number of documents in the collection according to the given options.
|
void |
count(Bson filter,
CountOptions options,
SingleResultCallback<Long> callback) |
Counts the number of documents in the collection according to the given options.
|
void |
createIndex(ClientSession clientSession,
Bson key,
SingleResultCallback<String> callback) |
Creates an index.
|
void |
createIndex(ClientSession clientSession,
Bson key,
IndexOptions options,
SingleResultCallback<String> callback) |
Creates an index.
|
void |
createIndex(Bson key,
SingleResultCallback<String> callback) |
Creates an index.
|
void |
createIndex(Bson key,
IndexOptions options,
SingleResultCallback<String> callback) |
Creates an index.
|
void |
createIndexes(ClientSession clientSession,
List<IndexModel> indexes,
SingleResultCallback<List<String>> callback) |
Create multiple indexes.
|
void |
createIndexes(ClientSession clientSession,
List<IndexModel> indexes,
CreateIndexOptions createIndexOptions,
SingleResultCallback<List<String>> callback) |
Create multiple indexes.
|
void |
createIndexes(List<IndexModel> indexes,
SingleResultCallback<List<String>> callback) |
Create multiple indexes.
|
void |
createIndexes(List<IndexModel> indexes,
CreateIndexOptions createIndexOptions,
SingleResultCallback<List<String>> callback) |
Create multiple indexes.
|
void |
deleteMany(ClientSession clientSession,
Bson filter,
SingleResultCallback<DeleteResult> callback) |
Removes all documents from the collection that match the given query filter.
|
void |
deleteMany(ClientSession clientSession,
Bson filter,
DeleteOptions options,
SingleResultCallback<DeleteResult> callback) |
Removes all documents from the collection that match the given query filter.
|
void |
deleteMany(Bson filter,
SingleResultCallback<DeleteResult> callback) |
Removes all documents from the collection that match the given query filter.
|
void |
deleteMany(Bson filter,
DeleteOptions options,
SingleResultCallback<DeleteResult> callback) |
Removes all documents from the collection that match the given query filter.
|
void |
deleteOne(ClientSession clientSession,
Bson filter,
SingleResultCallback<DeleteResult> callback) |
Removes at most one document from the collection that matches the given filter.
|
void |
deleteOne(ClientSession clientSession,
Bson filter,
DeleteOptions options,
SingleResultCallback<DeleteResult> callback) |
Removes at most one document from the collection that matches the given filter.
|
void |
deleteOne(Bson filter,
SingleResultCallback<DeleteResult> callback) |
Removes at most one document from the collection that matches the given filter.
|
void |
deleteOne(Bson filter,
DeleteOptions options,
SingleResultCallback<DeleteResult> callback) |
Removes at most one document from the collection that matches the given filter.
|
<TResult> DistinctIterable<TResult> |
distinct(ClientSession clientSession,
String fieldName,
Class<TResult> resultClass) |
Gets the distinct values of the specified field name.
|
<TResult> DistinctIterable<TResult> |
distinct(ClientSession clientSession,
String fieldName,
Bson filter,
Class<TResult> resultClass) |
Gets the distinct values of the specified field name.
|
<TResult> DistinctIterable<TResult> |
distinct(String fieldName,
Class<TResult> resultClass) |
Gets the distinct values of the specified field name.
|
<TResult> DistinctIterable<TResult> |
distinct(String fieldName,
Bson filter,
Class<TResult> resultClass) |
Gets the distinct values of the specified field name.
|
void |
drop(SingleResultCallback<Void> callback) |
Drops this collection from the Database.
|
void |
drop(ClientSession clientSession,
SingleResultCallback<Void> callback) |
Drops this collection from the Database.
|
void |
dropIndex(ClientSession clientSession,
String indexName,
SingleResultCallback<Void> callback) |
Drops the index given its name.
|
void |
dropIndex(ClientSession clientSession,
String indexName,
DropIndexOptions dropIndexOptions,
SingleResultCallback<Void> callback) |
Drops the index given its name.
|
void |
dropIndex(ClientSession clientSession,
Bson keys,
SingleResultCallback<Void> callback) |
Drops the index given the keys used to create it.
|
void |
dropIndex(ClientSession clientSession,
Bson keys,
DropIndexOptions dropIndexOptions,
SingleResultCallback<Void> callback) |
Drops the index given the keys used to create it.
|
void |
dropIndex(String indexName,
SingleResultCallback<Void> callback) |
Drops the index given its name.
|
void |
dropIndex(String indexName,
DropIndexOptions dropIndexOptions,
SingleResultCallback<Void> callback) |
Drops the index given its name.
|
void |
dropIndex(Bson keys,
SingleResultCallback<Void> callback) |
Drops the index given the keys used to create it.
|
void |
dropIndex(Bson keys,
DropIndexOptions dropIndexOptions,
SingleResultCallback<Void> callback) |
Drops the index given the keys used to create it.
|
void |
dropIndexes(SingleResultCallback<Void> callback) |
Drop all the indexes on this collection, except for the default on _id.
|
void |
dropIndexes(DropIndexOptions dropIndexOptions,
SingleResultCallback<Void> callback) |
Drop all the indexes on this collection, except for the default on _id.
|
void |
dropIndexes(ClientSession clientSession,
SingleResultCallback<Void> callback) |
Drop all the indexes on this collection, except for the default on _id.
|
void |
dropIndexes(ClientSession clientSession,
DropIndexOptions dropIndexOptions,
SingleResultCallback<Void> callback) |
Drop all the indexes on this collection, except for the default on _id.
|
FindIterable<TDocument> |
find() |
Finds all documents in the collection.
|
FindIterable<TDocument> |
find(ClientSession clientSession) |
Finds all documents in the collection.
|
<TResult> FindIterable<TResult> |
find(ClientSession clientSession,
Class<TResult> resultClass) |
Finds all documents in the collection.
|
FindIterable<TDocument> |
find(ClientSession clientSession,
Bson filter) |
Finds all documents in the collection.
|
<TResult> FindIterable<TResult> |
find(ClientSession clientSession,
Bson filter,
Class<TResult> resultClass) |
Finds all documents in the collection.
|
<TResult> FindIterable<TResult> |
find(Class<TResult> resultClass) |
Finds all documents in the collection.
|
FindIterable<TDocument> |
find(Bson filter) |
Finds all documents in the collection.
|
<TResult> FindIterable<TResult> |
find(Bson filter,
Class<TResult> resultClass) |
Finds all documents in the collection.
|
void |
findOneAndDelete(ClientSession clientSession,
Bson filter,
SingleResultCallback<TDocument> callback) |
Atomically find a document and remove it.
|
void |
findOneAndDelete(ClientSession clientSession,
Bson filter,
FindOneAndDeleteOptions options,
SingleResultCallback<TDocument> callback) |
Atomically find a document and remove it.
|
void |
findOneAndDelete(Bson filter,
SingleResultCallback<TDocument> callback) |
Atomically find a document and remove it.
|
void |
findOneAndDelete(Bson filter,
FindOneAndDeleteOptions options,
SingleResultCallback<TDocument> callback) |
Atomically find a document and remove it.
|
void |
findOneAndReplace(ClientSession clientSession,
Bson filter,
TDocument replacement,
SingleResultCallback<TDocument> callback) |
Atomically find a document and replace it.
|
void |
findOneAndReplace(ClientSession clientSession,
Bson filter,
TDocument replacement,
FindOneAndReplaceOptions options,
SingleResultCallback<TDocument> callback) |
Atomically find a document and replace it.
|
void |
findOneAndReplace(Bson filter,
TDocument replacement,
SingleResultCallback<TDocument> callback) |
Atomically find a document and replace it.
|
void |
findOneAndReplace(Bson filter,
TDocument replacement,
FindOneAndReplaceOptions options,
SingleResultCallback<TDocument> callback) |
Atomically find a document and replace it.
|
void |
findOneAndUpdate(ClientSession clientSession,
Bson filter,
Bson update,
SingleResultCallback<TDocument> callback) |
Atomically find a document and update it.
|
void |
findOneAndUpdate(ClientSession clientSession,
Bson filter,
Bson update,
FindOneAndUpdateOptions options,
SingleResultCallback<TDocument> callback) |
Atomically find a document and update it.
|
void |
findOneAndUpdate(Bson filter,
Bson update,
SingleResultCallback<TDocument> callback) |
Atomically find a document and update it.
|
void |
findOneAndUpdate(Bson filter,
Bson update,
FindOneAndUpdateOptions options,
SingleResultCallback<TDocument> callback) |
Atomically find a document and update it.
|
CodecRegistry |
getCodecRegistry() |
Get the codec registry for the MongoCollection.
|
Class<TDocument> |
getDocumentClass() |
Get the class of documents stored in this collection.
|
MongoNamespace |
getNamespace() |
Gets the namespace of this collection.
|
ReadConcern |
getReadConcern() |
Get the read concern for the MongoCollection.
|
ReadPreference |
getReadPreference() |
Get the read preference for the MongoCollection.
|
WriteConcern |
getWriteConcern() |
Get the write concern for the MongoCollection.
|
void |
insertMany(ClientSession clientSession,
List<? extends TDocument> documents,
SingleResultCallback<Void> callback) |
Inserts one or more documents.
|
void |
insertMany(ClientSession clientSession,
List<? extends TDocument> documents,
InsertManyOptions options,
SingleResultCallback<Void> callback) |
Inserts one or more documents.
|
void |
insertMany(List<? extends TDocument> documents,
SingleResultCallback<Void> callback) |
Inserts one or more documents.
|
void |
insertMany(List<? extends TDocument> documents,
InsertManyOptions options,
SingleResultCallback<Void> callback) |
Inserts one or more documents.
|
void |
insertOne(ClientSession clientSession,
TDocument document,
SingleResultCallback<Void> callback) |
Inserts the provided document.
|
void |
insertOne(ClientSession clientSession,
TDocument document,
InsertOneOptions options,
SingleResultCallback<Void> callback) |
Inserts the provided document.
|
void |
insertOne(TDocument document,
SingleResultCallback<Void> callback) |
Inserts the provided document.
|
void |
insertOne(TDocument document,
InsertOneOptions options,
SingleResultCallback<Void> callback) |
Inserts the provided document.
|
ListIndexesIterable<Document> |
listIndexes() |
Get all the indexes in this collection.
|
ListIndexesIterable<Document> |
listIndexes(ClientSession clientSession) |
Get all the indexes in this collection.
|
<TResult> ListIndexesIterable<TResult> |
listIndexes(ClientSession clientSession,
Class<TResult> resultClass) |
Get all the indexes in this collection.
|
<TResult> ListIndexesIterable<TResult> |
listIndexes(Class<TResult> resultClass) |
Get all the indexes in this collection.
|
MapReduceIterable<TDocument> |
mapReduce(ClientSession clientSession,
String mapFunction,
String reduceFunction) |
Aggregates documents according to the specified map-reduce function.
|
<TResult> MapReduceIterable<TResult> |
mapReduce(ClientSession clientSession,
String mapFunction,
String reduceFunction,
Class<TResult> resultClass) |
Aggregates documents according to the specified map-reduce function.
|
MapReduceIterable<TDocument> |
mapReduce(String mapFunction,
String reduceFunction) |
Aggregates documents according to the specified map-reduce function.
|
<TResult> MapReduceIterable<TResult> |
mapReduce(String mapFunction,
String reduceFunction,
Class<TResult> resultClass) |
Aggregates documents according to the specified map-reduce function.
|
void |
renameCollection(MongoNamespace newCollectionNamespace,
SingleResultCallback<Void> callback) |
Rename the collection with oldCollectionName to the newCollectionName.
|
void |
renameCollection(MongoNamespace newCollectionNamespace,
RenameCollectionOptions options,
SingleResultCallback<Void> callback) |
Rename the collection with oldCollectionName to the newCollectionName.
|
void |
renameCollection(ClientSession clientSession,
MongoNamespace newCollectionNamespace,
SingleResultCallback<Void> callback) |
Rename the collection with oldCollectionName to the newCollectionName.
|
void |
renameCollection(ClientSession clientSession,
MongoNamespace newCollectionNamespace,
RenameCollectionOptions options,
SingleResultCallback<Void> callback) |
Rename the collection with oldCollectionName to the newCollectionName.
|
void |
replaceOne(ClientSession clientSession,
Bson filter,
TDocument replacement,
SingleResultCallback<UpdateResult> callback) |
Replace a document in the collection according to the specified arguments.
|
void |
replaceOne(ClientSession clientSession,
Bson filter,
TDocument replacement,
ReplaceOptions options,
SingleResultCallback<UpdateResult> callback) |
Replace a document in the collection according to the specified arguments.
|
void |
replaceOne(ClientSession clientSession,
Bson filter,
TDocument replacement,
UpdateOptions options,
SingleResultCallback<UpdateResult> callback) |
|
void |
replaceOne(Bson filter,
TDocument replacement,
SingleResultCallback<UpdateResult> callback) |
Replace a document in the collection according to the specified arguments.
|
void |
replaceOne(Bson filter,
TDocument replacement,
ReplaceOptions options,
SingleResultCallback<UpdateResult> callback) |
Replace a document in the collection according to the specified arguments.
|
void |
replaceOne(Bson filter,
TDocument replacement,
UpdateOptions options,
SingleResultCallback<UpdateResult> callback) |
Deprecated.
|
void |
updateMany(ClientSession clientSession,
Bson filter,
Bson update,
SingleResultCallback<UpdateResult> callback) |
Update all documents in the collection according to the specified arguments.
|
void |
updateMany(ClientSession clientSession,
Bson filter,
Bson update,
UpdateOptions options,
SingleResultCallback<UpdateResult> callback) |
Update all documents in the collection according to the specified arguments.
|
void |
updateMany(Bson filter,
Bson update,
SingleResultCallback<UpdateResult> callback) |
Update all documents in the collection according to the specified arguments.
|
void |
updateMany(Bson filter,
Bson update,
UpdateOptions options,
SingleResultCallback<UpdateResult> callback) |
Update all documents in the collection according to the specified arguments.
|
void |
updateOne(ClientSession clientSession,
Bson filter,
Bson update,
SingleResultCallback<UpdateResult> callback) |
Update a single document in the collection according to the specified arguments.
|
void |
updateOne(ClientSession clientSession,
Bson filter,
Bson update,
UpdateOptions options,
SingleResultCallback<UpdateResult> callback) |
Update a single document in the collection according to the specified arguments.
|
void |
updateOne(Bson filter,
Bson update,
SingleResultCallback<UpdateResult> callback) |
Update a single document in the collection according to the specified arguments.
|
void |
updateOne(Bson filter,
Bson update,
UpdateOptions options,
SingleResultCallback<UpdateResult> callback) |
Update a single document in the collection according to the specified arguments.
|
ChangeStreamIterable<TDocument> |
watch() |
Creates a change stream for this collection.
|
ChangeStreamIterable<TDocument> |
watch(ClientSession clientSession) |
Creates a change stream for this collection.
|
<TResult> ChangeStreamIterable<TResult> |
watch(ClientSession clientSession,
Class<TResult> resultClass) |
Creates a change stream for this collection.
|
ChangeStreamIterable<TDocument> |
watch(ClientSession clientSession,
List<? extends Bson> pipeline) |
Creates a change stream for this collection.
|
<TResult> ChangeStreamIterable<TResult> |
watch(ClientSession clientSession,
List<? extends Bson> pipeline,
Class<TResult> resultClass) |
Creates a change stream for this collection.
|
<TResult> ChangeStreamIterable<TResult> |
watch(Class<TResult> resultClass) |
Creates a change stream for this collection.
|
ChangeStreamIterable<TDocument> |
watch(List<? extends Bson> pipeline) |
Creates a change stream for this collection.
|
<TResult> ChangeStreamIterable<TResult> |
watch(List<? extends Bson> pipeline,
Class<TResult> resultClass) |
Creates a change stream for this collection.
|
MongoCollection<TDocument> |
withCodecRegistry(CodecRegistry codecRegistry) |
Create a new MongoCollection instance with a different codec registry.
|
<NewTDocument> |
withDocumentClass(Class<NewTDocument> newDocumentClass) |
Create a new MongoCollection instance with a different default class to cast any documents returned from the database into..
|
MongoCollection<TDocument> |
withReadConcern(ReadConcern readConcern) |
Create a new MongoCollection instance with a different read concern.
|
MongoCollection<TDocument> |
withReadPreference(ReadPreference readPreference) |
Create a new MongoCollection instance with a different read preference.
|
MongoCollection<TDocument> |
withWriteConcern(WriteConcern writeConcern) |
Create a new MongoCollection instance with a different write concern.
|
MongoNamespace getNamespace()
Class<TDocument> getDocumentClass()
CodecRegistry getCodecRegistry()
CodecRegistry
ReadPreference getReadPreference()
ReadPreference
WriteConcern getWriteConcern()
WriteConcern
ReadConcern getReadConcern()
ReadConcern
<NewTDocument> MongoCollection<NewTDocument> withDocumentClass(Class<NewTDocument> newDocumentClass)
NewTDocument
- the type that the new collection will encode documents from and decode documents tonewDocumentClass
- the default class to cast any documents returned from the database into.MongoCollection<TDocument> withCodecRegistry(CodecRegistry codecRegistry)
codecRegistry
- the new CodecRegistry
for the collectionMongoCollection<TDocument> withReadPreference(ReadPreference readPreference)
readPreference
- the new ReadPreference
for the collectionMongoCollection<TDocument> withWriteConcern(WriteConcern writeConcern)
writeConcern
- the new WriteConcern
for the collectionMongoCollection<TDocument> withReadConcern(ReadConcern readConcern)
readConcern
- the new ReadConcern
for the collectionvoid count(SingleResultCallback<Long> callback)
callback
- the callback passed the number of documents in the collectionvoid count(Bson filter, SingleResultCallback<Long> callback)
filter
- the query filtercallback
- the callback passed the number of documents in the collectionvoid count(Bson filter, CountOptions options, SingleResultCallback<Long> callback)
filter
- the query filteroptions
- the options describing the countcallback
- the callback passed the number of documents in the collectionvoid count(ClientSession clientSession, SingleResultCallback<Long> callback)
clientSession
- the client session with which to associate this operationcallback
- the callback passed the number of documents in the collectionvoid count(ClientSession clientSession, Bson filter, SingleResultCallback<Long> callback)
clientSession
- the client session with which to associate this operationfilter
- the query filtercallback
- the callback passed the number of documents in the collectionvoid count(ClientSession clientSession, Bson filter, CountOptions options, SingleResultCallback<Long> callback)
clientSession
- the client session with which to associate this operationfilter
- the query filteroptions
- the options describing the countcallback
- the callback passed the number of documents in the collection<TResult> DistinctIterable<TResult> distinct(String fieldName, Class<TResult> resultClass)
TResult
- the target type of the iterable.fieldName
- the field nameresultClass
- the default class to cast any distinct items into.<TResult> DistinctIterable<TResult> distinct(String fieldName, Bson filter, Class<TResult> resultClass)
TResult
- the target type of the iterable.fieldName
- the field namefilter
- the query filterresultClass
- the default class to cast any distinct items into.<TResult> DistinctIterable<TResult> distinct(ClientSession clientSession, String fieldName, Class<TResult> resultClass)
TResult
- the target type of the iterable.clientSession
- the client session with which to associate this operationfieldName
- the field nameresultClass
- the default class to cast any distinct items into.<TResult> DistinctIterable<TResult> distinct(ClientSession clientSession, String fieldName, Bson filter, Class<TResult> resultClass)
TResult
- the target type of the iterable.clientSession
- the client session with which to associate this operationfieldName
- the field namefilter
- the query filterresultClass
- the default class to cast any distinct items into.FindIterable<TDocument> find()
<TResult> FindIterable<TResult> find(Class<TResult> resultClass)
TResult
- the target document type of the iterable.resultClass
- the class to decode each document intoFindIterable<TDocument> find(Bson filter)
filter
- the query filter<TResult> FindIterable<TResult> find(Bson filter, Class<TResult> resultClass)
TResult
- the target document type of the iterable.filter
- the query filterresultClass
- the class to decode each document intoFindIterable<TDocument> find(ClientSession clientSession)
<TResult> FindIterable<TResult> find(ClientSession clientSession, Class<TResult> resultClass)
TResult
- the target document type of the iterable.clientSession
- the client session with which to associate this operationresultClass
- the class to decode each document intoFindIterable<TDocument> find(ClientSession clientSession, Bson filter)
<TResult> FindIterable<TResult> find(ClientSession clientSession, Bson filter, Class<TResult> resultClass)
TResult
- the target document type of the iterable.clientSession
- the client session with which to associate this operationfilter
- the query filterresultClass
- the class to decode each document intoAggregateIterable<TDocument> aggregate(List<? extends Bson> pipeline)
pipeline
- the aggregate pipeline<TResult> AggregateIterable<TResult> aggregate(List<? extends Bson> pipeline, Class<TResult> resultClass)
TResult
- the target document type of the iterable.pipeline
- the aggregate pipelineresultClass
- the class to decode each document intoAggregateIterable<TDocument> aggregate(ClientSession clientSession, List<? extends Bson> pipeline)
clientSession
- the client session with which to associate this operationpipeline
- the aggregate pipeline<TResult> AggregateIterable<TResult> aggregate(ClientSession clientSession, List<? extends Bson> pipeline, Class<TResult> resultClass)
TResult
- the target document type of the iterable.clientSession
- the client session with which to associate this operationpipeline
- the aggregate pipelineresultClass
- the class to decode each document intoChangeStreamIterable<TDocument> watch()
<TResult> ChangeStreamIterable<TResult> watch(Class<TResult> resultClass)
TResult
- the target document type of the iterable.resultClass
- the class to decode each document intoChangeStreamIterable<TDocument> watch(List<? extends Bson> pipeline)
pipeline
- the aggregation pipeline to apply to the change stream<TResult> ChangeStreamIterable<TResult> watch(List<? extends Bson> pipeline, Class<TResult> resultClass)
TResult
- the target document type of the iterable.pipeline
- the aggregation pipeline to apply to the change streamresultClass
- the class to decode each document intoChangeStreamIterable<TDocument> watch(ClientSession clientSession)
clientSession
- the client session with which to associate this operation<TResult> ChangeStreamIterable<TResult> watch(ClientSession clientSession, Class<TResult> resultClass)
TResult
- the target document type of the iterable.clientSession
- the client session with which to associate this operationresultClass
- the class to decode each document intoChangeStreamIterable<TDocument> watch(ClientSession clientSession, List<? extends Bson> pipeline)
clientSession
- the client session with which to associate this operationpipeline
- the aggregation pipeline to apply to the change stream<TResult> ChangeStreamIterable<TResult> watch(ClientSession clientSession, List<? extends Bson> pipeline, Class<TResult> resultClass)
TResult
- the target document type of the iterable.clientSession
- the client session with which to associate this operationpipeline
- the aggregation pipeline to apply to the change streamresultClass
- the class to decode each document intoMapReduceIterable<TDocument> mapReduce(String mapFunction, String reduceFunction)
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.<TResult> MapReduceIterable<TResult> mapReduce(String mapFunction, String reduceFunction, Class<TResult> resultClass)
TResult
- the target document type of the iterable.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.MapReduceIterable<TDocument> mapReduce(ClientSession clientSession, String mapFunction, String reduceFunction)
clientSession
- the client session with which to associate this operationmapFunction
- 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.<TResult> MapReduceIterable<TResult> mapReduce(ClientSession clientSession, String mapFunction, String reduceFunction, Class<TResult> resultClass)
TResult
- the target document type of the iterable.clientSession
- the client session with which to associate this operationmapFunction
- 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.void bulkWrite(List<? extends WriteModel<? extends TDocument>> requests, SingleResultCallback<BulkWriteResult> callback)
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.
requests
- the writes to executecallback
- the callback passed the result of the bulk writevoid bulkWrite(List<? extends WriteModel<? extends TDocument>> requests, BulkWriteOptions options, SingleResultCallback<BulkWriteResult> callback)
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.
requests
- the writes to executeoptions
- the options to apply to the bulk write operationcallback
- the callback passed the result of the bulk writevoid bulkWrite(ClientSession clientSession, List<? extends WriteModel<? extends TDocument>> requests, SingleResultCallback<BulkWriteResult> callback)
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.
clientSession
- the client session with which to associate this operationrequests
- the writes to executecallback
- the callback passed the result of the bulk writevoid bulkWrite(ClientSession clientSession, List<? extends WriteModel<? extends TDocument>> requests, BulkWriteOptions options, SingleResultCallback<BulkWriteResult> callback)
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.
clientSession
- the client session with which to associate this operationrequests
- the writes to executeoptions
- the options to apply to the bulk write operationcallback
- the callback passed the result of the bulk writevoid insertOne(TDocument document, SingleResultCallback<Void> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
document
- the document to insertcallback
- the callback that is completed once the insert has completedMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid insertOne(TDocument document, InsertOneOptions options, SingleResultCallback<Void> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
document
- the document to insertoptions
- the options to apply to the operationcallback
- the callback that is completed once the insert has completedMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoCommandException
- returned via the callbackMongoException
- returned via the callbackvoid insertOne(ClientSession clientSession, TDocument document, SingleResultCallback<Void> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationdocument
- the document to insertcallback
- the callback that is completed once the insert has completedMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid insertOne(ClientSession clientSession, TDocument document, InsertOneOptions options, SingleResultCallback<Void> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationdocument
- the document to insertoptions
- the options to apply to the operationcallback
- the callback that is completed once the insert has completedMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoCommandException
- returned via the callbackMongoException
- returned via the callbackvoid insertMany(List<? extends TDocument> documents, SingleResultCallback<Void> callback)
bulkWrite
method
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
documents
- the documents to insertcallback
- the callback that is completed once the insert has completedMongoBulkWriteException
- if there's an exception in the bulk write operationMongoException
- if the write failed due some other failurebulkWrite(java.util.List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>>, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult>)
void insertMany(List<? extends TDocument> documents, InsertManyOptions options, SingleResultCallback<Void> callback)
bulkWrite
method
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
documents
- the documents to insertoptions
- the options to apply to the operationcallback
- the callback that is completed once the insert has completedMongoBulkWriteException
- if there's an exception in the bulk write operationMongoException
- if the write failed due some other failurebulkWrite(java.util.List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>>, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult>)
void insertMany(ClientSession clientSession, List<? extends TDocument> documents, SingleResultCallback<Void> callback)
bulkWrite
method
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationdocuments
- the documents to insertcallback
- the callback that is completed once the insert has completedMongoBulkWriteException
- if there's an exception in the bulk write operationMongoException
- if the write failed due some other failurebulkWrite(java.util.List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>>, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult>)
void insertMany(ClientSession clientSession, List<? extends TDocument> documents, InsertManyOptions options, SingleResultCallback<Void> callback)
bulkWrite
method
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationdocuments
- the documents to insertoptions
- the options to apply to the operationcallback
- the callback that is completed once the insert has completedMongoBulkWriteException
- if there's an exception in the bulk write operationMongoException
- if the write failed due some other failurebulkWrite(java.util.List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>>, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult>)
void deleteOne(Bson filter, SingleResultCallback<DeleteResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
filter
- the query filter to apply the the delete operationcallback
- the callback passed the result of the remove one operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid deleteOne(Bson filter, DeleteOptions options, SingleResultCallback<DeleteResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
filter
- the query filter to apply the the delete operationoptions
- the options to apply to the delete operationcallback
- the callback passed the result of the remove one operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid deleteOne(ClientSession clientSession, Bson filter, SingleResultCallback<DeleteResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the delete operationcallback
- the callback passed the result of the remove one operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid deleteOne(ClientSession clientSession, Bson filter, DeleteOptions options, SingleResultCallback<DeleteResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the delete operationoptions
- the options to apply to the delete operationcallback
- the callback passed the result of the remove one operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid deleteMany(Bson filter, SingleResultCallback<DeleteResult> callback)
filter
- the query filter to apply the the delete operationcallback
- the callback passed the result of the remove many operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid deleteMany(Bson filter, DeleteOptions options, SingleResultCallback<DeleteResult> callback)
filter
- the query filter to apply the the delete operationoptions
- the options to apply to the delete operationcallback
- the callback passed the result of the remove many operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid deleteMany(ClientSession clientSession, Bson filter, SingleResultCallback<DeleteResult> callback)
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the delete operationcallback
- the callback passed the result of the remove many operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid deleteMany(ClientSession clientSession, Bson filter, DeleteOptions options, SingleResultCallback<DeleteResult> callback)
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the delete operationoptions
- the options to apply to the delete operationcallback
- the callback passed the result of the remove many operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid replaceOne(Bson filter, TDocument replacement, SingleResultCallback<UpdateResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
filter
- the query filter to apply the the replace operationreplacement
- the replacement documentcallback
- the callback passed the result of the replace one operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callback@Deprecated void replaceOne(Bson filter, TDocument replacement, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
replaceOne(Bson, Object, ReplaceOptions, SingleResultCallback)
insteadNote: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
filter
- the query filter to apply the the replace operationreplacement
- the replacement documentoptions
- the options to apply to the replace operationcallback
- the callback passed the result of the replace one operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid replaceOne(Bson filter, TDocument replacement, ReplaceOptions options, SingleResultCallback<UpdateResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
filter
- the query filter to apply the the replace operationreplacement
- the replacement documentoptions
- the options to apply to the replace operationcallback
- the callback passed the result of the replace one operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid replaceOne(ClientSession clientSession, Bson filter, TDocument replacement, SingleResultCallback<UpdateResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the replace operationreplacement
- the replacement documentcallback
- the callback passed the result of the replace one operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callback@Deprecated void replaceOne(ClientSession clientSession, Bson filter, TDocument replacement, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the replace operationreplacement
- the replacement documentoptions
- the options to apply to the replace operationcallback
- the callback passed the result of the replace one operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid replaceOne(ClientSession clientSession, Bson filter, TDocument replacement, ReplaceOptions options, SingleResultCallback<UpdateResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the replace operationreplacement
- the replacement documentoptions
- the options to apply to the replace operationcallback
- the callback passed the result of the replace one operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid updateOne(Bson filter, Bson update, SingleResultCallback<UpdateResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
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 operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid updateOne(Bson filter, Bson update, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
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 operationcallback
- the callback passed the result of the update one operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid updateOne(ClientSession clientSession, Bson filter, Bson update, SingleResultCallback<UpdateResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- 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 operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid updateOne(ClientSession clientSession, Bson filter, Bson update, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- 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 operationcallback
- the callback passed the result of the update one operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid updateMany(Bson filter, Bson update, SingleResultCallback<UpdateResult> callback)
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. Tcallback
- the callback passed the result of the update many operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid updateMany(Bson filter, Bson update, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
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 operationcallback
- the callback passed the result of the update many operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid updateMany(ClientSession clientSession, Bson filter, Bson update, SingleResultCallback<UpdateResult> callback)
clientSession
- the client session with which to associate this operationfilter
- 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. Tcallback
- the callback passed the result of the update many operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid updateMany(ClientSession clientSession, Bson filter, Bson update, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
clientSession
- the client session with which to associate this operationfilter
- 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 operationcallback
- the callback passed the result of the update many operationMongoWriteException
- returned via the callbackMongoWriteConcernException
- returned via the callbackMongoException
- returned via the callbackvoid findOneAndDelete(Bson filter, SingleResultCallback<TDocument> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
filter
- the query filter to find the document withcallback
- the callback passed the document that was removed. If no documents matched the query filter, then null will be
returnedvoid findOneAndDelete(Bson filter, FindOneAndDeleteOptions options, SingleResultCallback<TDocument> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
filter
- the query filter to find the document withoptions
- the options to apply to the operationcallback
- the callback passed the document that was removed. If no documents matched the query filter, then null will be
returnedvoid findOneAndDelete(ClientSession clientSession, Bson filter, SingleResultCallback<TDocument> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- the query filter to find the document withcallback
- the callback passed the document that was removed. If no documents matched the query filter, then null will be
returnedvoid findOneAndDelete(ClientSession clientSession, Bson filter, FindOneAndDeleteOptions options, SingleResultCallback<TDocument> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- the query filter to find the document withoptions
- the options to apply to the operationcallback
- the callback passed the document that was removed. If no documents matched the query filter, then null will be
returnedvoid findOneAndReplace(Bson filter, TDocument replacement, SingleResultCallback<TDocument> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
filter
- the query filter to apply the the replace operationreplacement
- the replacement documentcallback
- 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 returnedvoid findOneAndReplace(Bson filter, TDocument replacement, FindOneAndReplaceOptions options, SingleResultCallback<TDocument> callback)
filter
- the query filter to apply the the replace operationreplacement
- the replacement documentoptions
- the options to apply to the operationcallback
- 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 returnedvoid findOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement, SingleResultCallback<TDocument> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the replace operationreplacement
- the replacement documentcallback
- 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 returnedvoid findOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement, FindOneAndReplaceOptions options, SingleResultCallback<TDocument> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the replace operationreplacement
- the replacement documentoptions
- the options to apply to the operationcallback
- 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 returnedvoid findOneAndUpdate(Bson filter, Bson update, SingleResultCallback<TDocument> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
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 returnedvoid findOneAndUpdate(Bson filter, Bson update, FindOneAndUpdateOptions options, SingleResultCallback<TDocument> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
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 operationcallback
- 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 returnedvoid findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update, SingleResultCallback<TDocument> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- 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 returnedvoid findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update, FindOneAndUpdateOptions options, SingleResultCallback<TDocument> callback)
Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
clientSession
- the client session with which to associate this operationfilter
- 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 operationcallback
- 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 returnedvoid drop(SingleResultCallback<Void> callback)
callback
- the callback that is completed once the collection has been droppedvoid drop(ClientSession clientSession, SingleResultCallback<Void> callback)
clientSession
- the client session with which to associate this operationcallback
- the callback that is completed once the collection has been droppedvoid createIndex(Bson key, SingleResultCallback<String> callback)
key
- an object describing the index key(s), which may not be null.callback
- the callback that is completed once the index has been createdvoid createIndex(Bson key, IndexOptions options, SingleResultCallback<String> callback)
key
- an object describing the index key(s), which may not be null.options
- the options for the indexcallback
- the callback that is completed once the index has been createdvoid createIndex(ClientSession clientSession, Bson key, SingleResultCallback<String> callback)
clientSession
- the client session with which to associate this operationkey
- an object describing the index key(s), which may not be null.callback
- the callback that is completed once the index has been createdvoid createIndex(ClientSession clientSession, Bson key, IndexOptions options, SingleResultCallback<String> callback)
clientSession
- the client session with which to associate this operationkey
- an object describing the index key(s), which may not be null.options
- the options for the indexcallback
- the callback that is completed once the index has been createdvoid createIndexes(List<IndexModel> indexes, SingleResultCallback<List<String>> callback)
indexes
- the list of indexescallback
- the callback that is completed once the indexes has been createdvoid createIndexes(List<IndexModel> indexes, CreateIndexOptions createIndexOptions, SingleResultCallback<List<String>> callback)
indexes
- the list of indexescreateIndexOptions
- options to use when creating indexescallback
- the callback that is completed once the indexes has been createdvoid createIndexes(ClientSession clientSession, List<IndexModel> indexes, SingleResultCallback<List<String>> callback)
clientSession
- the client session with which to associate this operationindexes
- the list of indexescallback
- the callback that is completed once the indexes has been createdvoid createIndexes(ClientSession clientSession, List<IndexModel> indexes, CreateIndexOptions createIndexOptions, SingleResultCallback<List<String>> callback)
clientSession
- the client session with which to associate this operationindexes
- the list of indexescreateIndexOptions
- options to use when creating indexescallback
- the callback that is completed once the indexes has been createdListIndexesIterable<Document> listIndexes()
<TResult> ListIndexesIterable<TResult> listIndexes(Class<TResult> resultClass)
TResult
- the target document type of the iterable.resultClass
- the class to decode each document intoListIndexesIterable<Document> listIndexes(ClientSession clientSession)
clientSession
- the client session with which to associate this operation<TResult> ListIndexesIterable<TResult> listIndexes(ClientSession clientSession, Class<TResult> resultClass)
TResult
- the target document type of the iterable.clientSession
- the client session with which to associate this operationresultClass
- the class to decode each document intovoid dropIndex(String indexName, SingleResultCallback<Void> callback)
indexName
- the name of the index to removecallback
- the callback that is completed once the index has been droppedvoid dropIndex(String indexName, DropIndexOptions dropIndexOptions, SingleResultCallback<Void> callback)
indexName
- the name of the index to removedropIndexOptions
- options to use when dropping indexescallback
- the callback that is completed once the index has been droppedvoid dropIndex(Bson keys, SingleResultCallback<Void> callback)
keys
- the keys of the index to removecallback
- the callback that is completed once the index has been droppedvoid dropIndex(Bson keys, DropIndexOptions dropIndexOptions, SingleResultCallback<Void> callback)
keys
- the keys of the index to removedropIndexOptions
- options to use when dropping indexescallback
- the callback that is completed once the index has been droppedvoid dropIndex(ClientSession clientSession, String indexName, SingleResultCallback<Void> callback)
clientSession
- the client session with which to associate this operationindexName
- the name of the index to removecallback
- the callback that is completed once the index has been droppedvoid dropIndex(ClientSession clientSession, String indexName, DropIndexOptions dropIndexOptions, SingleResultCallback<Void> callback)
clientSession
- the client session with which to associate this operationindexName
- the name of the index to removedropIndexOptions
- options to use when dropping indexescallback
- the callback that is completed once the index has been droppedvoid dropIndex(ClientSession clientSession, Bson keys, SingleResultCallback<Void> callback)
clientSession
- the client session with which to associate this operationkeys
- the keys of the index to removecallback
- the callback that is completed once the index has been droppedvoid dropIndex(ClientSession clientSession, Bson keys, DropIndexOptions dropIndexOptions, SingleResultCallback<Void> callback)
clientSession
- the client session with which to associate this operationkeys
- the keys of the index to removedropIndexOptions
- options to use when dropping indexescallback
- the callback that is completed once the index has been droppedvoid dropIndexes(SingleResultCallback<Void> callback)
callback
- the callback that is completed once all the indexes have been droppedvoid dropIndexes(DropIndexOptions dropIndexOptions, SingleResultCallback<Void> callback)
dropIndexOptions
- options to use when dropping indexescallback
- the callback that is completed once all the indexes have been droppedvoid dropIndexes(ClientSession clientSession, SingleResultCallback<Void> callback)
clientSession
- the client session with which to associate this operationcallback
- the callback that is completed once all the indexes have been droppedvoid dropIndexes(ClientSession clientSession, DropIndexOptions dropIndexOptions, SingleResultCallback<Void> callback)
clientSession
- the client session with which to associate this operationdropIndexOptions
- options to use when dropping indexescallback
- the callback that is completed once all the indexes have been droppedvoid renameCollection(MongoNamespace newCollectionNamespace, SingleResultCallback<Void> callback)
newCollectionNamespace
- the namespace the collection will be renamed tocallback
- the callback that is completed once the collection has been renamedMongoServerException
- 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 existvoid renameCollection(MongoNamespace newCollectionNamespace, RenameCollectionOptions options, SingleResultCallback<Void> callback)
newCollectionNamespace
- the name the collection will be renamed tooptions
- the options for renaming a collectioncallback
- the callback that is completed once the collection has been renamedMongoServerException
- 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 existvoid renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace, SingleResultCallback<Void> callback)
clientSession
- the client session with which to associate this operationnewCollectionNamespace
- the namespace the collection will be renamed tocallback
- the callback that is completed once the collection has been renamedMongoServerException
- 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 existvoid renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace, RenameCollectionOptions options, SingleResultCallback<Void> callback)
clientSession
- the client session with which to associate this operationnewCollectionNamespace
- the name the collection will be renamed tooptions
- the options for renaming a collectioncallback
- the callback that is completed once the collection has been renamedMongoServerException
- 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