class MongoCollectionImpl<TDocument> extends java.lang.Object implements MongoCollection<TDocument>
Modifier and Type | Field and Description |
---|---|
private CodecRegistry |
codecRegistry |
private java.lang.Class<TDocument> |
documentClass |
private AsyncOperationExecutor |
executor |
private static Logger |
LOGGER |
private MongoNamespace |
namespace |
private ReadConcern |
readConcern |
private ReadPreference |
readPreference |
private WriteConcern |
writeConcern |
Constructor and Description |
---|
MongoCollectionImpl(MongoNamespace namespace,
java.lang.Class<TDocument> documentClass,
CodecRegistry codecRegistry,
ReadPreference readPreference,
WriteConcern writeConcern,
ReadConcern readConcern,
AsyncOperationExecutor executor) |
Modifier and Type | Method and Description |
---|---|
AggregateIterable<TDocument> |
aggregate(java.util.List<? extends Bson> pipeline)
Aggregates documents according to the specified aggregation pipeline.
|
<TResult> AggregateIterable<TResult> |
aggregate(java.util.List<? extends Bson> pipeline,
java.lang.Class<TResult> resultClass)
Aggregates documents according to the specified aggregation pipeline.
|
void |
bulkWrite(java.util.List<? extends WriteModel<? extends TDocument>> requests,
BulkWriteOptions options,
SingleResultCallback<BulkWriteResult> callback)
Executes a mix of inserts, updates, replaces, and deletes.
|
void |
bulkWrite(java.util.List<? extends WriteModel<? extends TDocument>> requests,
SingleResultCallback<BulkWriteResult> callback)
Executes a mix of inserts, updates, replaces, and deletes.
|
void |
count(Bson filter,
CountOptions options,
SingleResultCallback<java.lang.Long> callback)
Counts the number of documents in the collection according to the given options.
|
void |
count(Bson filter,
SingleResultCallback<java.lang.Long> callback)
Counts the number of documents in the collection according to the given options.
|
void |
count(SingleResultCallback<java.lang.Long> callback)
Counts the number of documents in the collection.
|
void |
createIndex(Bson key,
IndexOptions indexOptions,
SingleResultCallback<java.lang.String> callback)
Creates an index.
|
void |
createIndex(Bson key,
SingleResultCallback<java.lang.String> callback)
Creates an index.
|
void |
createIndexes(java.util.List<IndexModel> indexes,
SingleResultCallback<java.util.List<java.lang.String>> callback)
Create multiple indexes.
|
private void |
delete(Bson filter,
DeleteOptions options,
boolean multi,
SingleResultCallback<DeleteResult> callback) |
void |
deleteMany(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 |
deleteOne(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.
|
<TResult> DistinctIterable<TResult> |
distinct(java.lang.String fieldName,
Bson filter,
java.lang.Class<TResult> resultClass)
Gets the distinct values of the specified field name.
|
<TResult> DistinctIterable<TResult> |
distinct(java.lang.String fieldName,
java.lang.Class<TResult> resultClass)
Gets the distinct values of the specified field name.
|
private BsonDocument |
documentToBsonDocument(TDocument document) |
void |
drop(SingleResultCallback<java.lang.Void> callback)
Drops this collection from the Database.
|
void |
dropIndex(Bson keys,
SingleResultCallback<java.lang.Void> callback)
Drops the index given the keys used to create it.
|
void |
dropIndex(java.lang.String indexName,
SingleResultCallback<java.lang.Void> callback)
Drops the index given its name.
|
void |
dropIndexes(SingleResultCallback<java.lang.Void> callback)
Drop all the indexes on this collection, except for the default on _id.
|
private void |
executeSingleWriteRequest(WriteRequest request,
java.lang.Boolean bypassDocumentValidation,
SingleResultCallback<BulkWriteResult> callback) |
FindIterable<TDocument> |
find()
Finds all documents in the collection.
|
FindIterable<TDocument> |
find(Bson filter)
Finds all documents in the collection.
|
<TResult> FindIterable<TResult> |
find(Bson filter,
java.lang.Class<TResult> resultClass)
Finds all documents in the collection.
|
<TResult> FindIterable<TResult> |
find(java.lang.Class<TResult> resultClass)
Finds all documents in the collection.
|
void |
findOneAndDelete(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 |
findOneAndReplace(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 |
findOneAndUpdate(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.
|
private Codec<TDocument> |
getCodec() |
private <TResult> Codec<TResult> |
getCodec(java.lang.Class<TResult> resultClass) |
CodecRegistry |
getCodecRegistry()
Get the codec registry for the MongoCollection.
|
java.lang.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(java.util.List<? extends TDocument> documents,
InsertManyOptions options,
SingleResultCallback<java.lang.Void> callback)
Inserts one or more documents.
|
void |
insertMany(java.util.List<? extends TDocument> documents,
SingleResultCallback<java.lang.Void> callback)
Inserts one or more documents.
|
void |
insertOne(TDocument document,
InsertOneOptions options,
SingleResultCallback<java.lang.Void> callback)
Inserts the provided document.
|
void |
insertOne(TDocument document,
SingleResultCallback<java.lang.Void> callback)
Inserts the provided document.
|
ListIndexesIterable<Document> |
listIndexes()
Get all the indexes in this collection.
|
<TResult> ListIndexesIterable<TResult> |
listIndexes(java.lang.Class<TResult> resultClass)
Get all the indexes in this collection.
|
MapReduceIterable<TDocument> |
mapReduce(java.lang.String mapFunction,
java.lang.String reduceFunction)
Aggregates documents according to the specified map-reduce function.
|
<TResult> MapReduceIterable<TResult> |
mapReduce(java.lang.String mapFunction,
java.lang.String reduceFunction,
java.lang.Class<TResult> resultClass)
Aggregates documents according to the specified map-reduce function.
|
void |
renameCollection(MongoNamespace newCollectionNamespace,
RenameCollectionOptions options,
SingleResultCallback<java.lang.Void> callback)
Rename the collection with oldCollectionName to the newCollectionName.
|
void |
renameCollection(MongoNamespace newCollectionNamespace,
SingleResultCallback<java.lang.Void> callback)
Rename the collection with oldCollectionName to the newCollectionName.
|
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,
UpdateOptions options,
SingleResultCallback<UpdateResult> callback)
Replace a document in the collection according to the specified arguments.
|
private BsonDocument |
toBsonDocument(Bson document) |
private UpdateResult |
toUpdateResult(BulkWriteResult result) |
private WriteConcernResult |
translateBulkWriteResult(WriteRequest request,
BulkWriteResult writeResult) |
private void |
update(Bson filter,
Bson update,
UpdateOptions options,
boolean multi,
SingleResultCallback<UpdateResult> callback) |
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(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.
|
MongoCollection<TDocument> |
withCodecRegistry(CodecRegistry codecRegistry)
Create a new MongoCollection instance with a different codec registry.
|
<NewTDocument> |
withDocumentClass(java.lang.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.
|
private static final Logger LOGGER
private final MongoNamespace namespace
private final java.lang.Class<TDocument> documentClass
private final ReadPreference readPreference
private final CodecRegistry codecRegistry
private final WriteConcern writeConcern
private final ReadConcern readConcern
private final AsyncOperationExecutor executor
MongoCollectionImpl(MongoNamespace namespace, java.lang.Class<TDocument> documentClass, CodecRegistry codecRegistry, ReadPreference readPreference, WriteConcern writeConcern, ReadConcern readConcern, AsyncOperationExecutor executor)
public MongoNamespace getNamespace()
MongoCollection
getNamespace
in interface MongoCollection<TDocument>
public java.lang.Class<TDocument> getDocumentClass()
MongoCollection
getDocumentClass
in interface MongoCollection<TDocument>
public CodecRegistry getCodecRegistry()
MongoCollection
getCodecRegistry
in interface MongoCollection<TDocument>
CodecRegistry
public ReadPreference getReadPreference()
MongoCollection
getReadPreference
in interface MongoCollection<TDocument>
ReadPreference
public WriteConcern getWriteConcern()
MongoCollection
getWriteConcern
in interface MongoCollection<TDocument>
WriteConcern
public ReadConcern getReadConcern()
MongoCollection
getReadConcern
in interface MongoCollection<TDocument>
ReadConcern
public <NewTDocument> MongoCollection<NewTDocument> withDocumentClass(java.lang.Class<NewTDocument> newDocumentClass)
MongoCollection
withDocumentClass
in interface MongoCollection<TDocument>
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.public MongoCollection<TDocument> withCodecRegistry(CodecRegistry codecRegistry)
MongoCollection
withCodecRegistry
in interface MongoCollection<TDocument>
codecRegistry
- the new CodecRegistry
for the collectionpublic MongoCollection<TDocument> withReadPreference(ReadPreference readPreference)
MongoCollection
withReadPreference
in interface MongoCollection<TDocument>
readPreference
- the new ReadPreference
for the collectionpublic MongoCollection<TDocument> withWriteConcern(WriteConcern writeConcern)
MongoCollection
withWriteConcern
in interface MongoCollection<TDocument>
writeConcern
- the new WriteConcern
for the collectionpublic MongoCollection<TDocument> withReadConcern(ReadConcern readConcern)
MongoCollection
withReadConcern
in interface MongoCollection<TDocument>
readConcern
- the new ReadConcern
for the collectionpublic void count(SingleResultCallback<java.lang.Long> callback)
MongoCollection
count
in interface MongoCollection<TDocument>
callback
- the callback passed the number of documents in the collectionpublic void count(Bson filter, SingleResultCallback<java.lang.Long> callback)
MongoCollection
count
in interface MongoCollection<TDocument>
filter
- the query filtercallback
- the callback passed the number of documents in the collectionpublic void count(Bson filter, CountOptions options, SingleResultCallback<java.lang.Long> callback)
MongoCollection
count
in interface MongoCollection<TDocument>
filter
- the query filteroptions
- the options describing the countcallback
- the callback passed the number of documents in the collectionpublic <TResult> DistinctIterable<TResult> distinct(java.lang.String fieldName, java.lang.Class<TResult> resultClass)
MongoCollection
distinct
in interface MongoCollection<TDocument>
TResult
- the target type of the iterable.fieldName
- the field nameresultClass
- the default class to cast any distinct items into.public <TResult> DistinctIterable<TResult> distinct(java.lang.String fieldName, Bson filter, java.lang.Class<TResult> resultClass)
MongoCollection
distinct
in interface MongoCollection<TDocument>
TResult
- the target type of the iterable.fieldName
- the field namefilter
- the query filterresultClass
- the default class to cast any distinct items into.public FindIterable<TDocument> find()
MongoCollection
find
in interface MongoCollection<TDocument>
public <TResult> FindIterable<TResult> find(java.lang.Class<TResult> resultClass)
MongoCollection
find
in interface MongoCollection<TDocument>
TResult
- the target document type of the iterable.resultClass
- the class to decode each document intopublic FindIterable<TDocument> find(Bson filter)
MongoCollection
find
in interface MongoCollection<TDocument>
filter
- the query filterpublic <TResult> FindIterable<TResult> find(Bson filter, java.lang.Class<TResult> resultClass)
MongoCollection
find
in interface MongoCollection<TDocument>
TResult
- the target document type of the iterable.filter
- the query filterresultClass
- the class to decode each document intopublic AggregateIterable<TDocument> aggregate(java.util.List<? extends Bson> pipeline)
MongoCollection
aggregate
in interface MongoCollection<TDocument>
pipeline
- the aggregate pipelinepublic <TResult> AggregateIterable<TResult> aggregate(java.util.List<? extends Bson> pipeline, java.lang.Class<TResult> resultClass)
MongoCollection
aggregate
in interface MongoCollection<TDocument>
TResult
- the target document type of the iterable.pipeline
- the aggregate pipelineresultClass
- the class to decode each document intopublic MapReduceIterable<TDocument> mapReduce(java.lang.String mapFunction, java.lang.String reduceFunction)
MongoCollection
mapReduce
in interface MongoCollection<TDocument>
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.public <TResult> MapReduceIterable<TResult> mapReduce(java.lang.String mapFunction, java.lang.String reduceFunction, java.lang.Class<TResult> resultClass)
MongoCollection
mapReduce
in interface MongoCollection<TDocument>
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.public void bulkWrite(java.util.List<? extends WriteModel<? extends TDocument>> requests, SingleResultCallback<BulkWriteResult> callback)
MongoCollection
bulkWrite
in interface MongoCollection<TDocument>
requests
- the writes to executecallback
- the callback passed the result of the bulk writepublic void bulkWrite(java.util.List<? extends WriteModel<? extends TDocument>> requests, BulkWriteOptions options, SingleResultCallback<BulkWriteResult> callback)
MongoCollection
bulkWrite
in interface MongoCollection<TDocument>
requests
- the writes to executeoptions
- the options to apply to the bulk write operationcallback
- the callback passed the result of the bulk writepublic void insertOne(TDocument document, SingleResultCallback<java.lang.Void> callback)
MongoCollection
insertOne
in interface MongoCollection<TDocument>
document
- the document to insertcallback
- the callback that is completed once the insert has completedpublic void insertOne(TDocument document, InsertOneOptions options, SingleResultCallback<java.lang.Void> callback)
MongoCollection
insertOne
in interface MongoCollection<TDocument>
document
- the document to insertoptions
- the options to apply to the operationcallback
- the callback that is completed once the insert has completedpublic void insertMany(java.util.List<? extends TDocument> documents, SingleResultCallback<java.lang.Void> callback)
MongoCollection
bulkWrite
methodinsertMany
in interface MongoCollection<TDocument>
documents
- the documents to insertcallback
- the callback that is completed once the insert has completedMongoCollection.bulkWrite(java.util.List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>>, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult>)
public void insertMany(java.util.List<? extends TDocument> documents, InsertManyOptions options, SingleResultCallback<java.lang.Void> callback)
MongoCollection
bulkWrite
methodinsertMany
in interface MongoCollection<TDocument>
documents
- the documents to insertoptions
- the options to apply to the operationcallback
- the callback that is completed once the insert has completedMongoCollection.bulkWrite(java.util.List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>>, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult>)
public void deleteOne(Bson filter, SingleResultCallback<DeleteResult> callback)
MongoCollection
deleteOne
in interface MongoCollection<TDocument>
filter
- the query filter to apply the the delete operationcallback
- the callback passed the result of the remove one operationpublic void deleteOne(Bson filter, DeleteOptions options, SingleResultCallback<DeleteResult> callback)
MongoCollection
deleteOne
in interface MongoCollection<TDocument>
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 operationpublic void deleteMany(Bson filter, SingleResultCallback<DeleteResult> callback)
MongoCollection
deleteMany
in interface MongoCollection<TDocument>
filter
- the query filter to apply the the delete operationcallback
- the callback passed the result of the remove many operationpublic void deleteMany(Bson filter, DeleteOptions options, SingleResultCallback<DeleteResult> callback)
MongoCollection
deleteMany
in interface MongoCollection<TDocument>
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 operationpublic void replaceOne(Bson filter, TDocument replacement, SingleResultCallback<UpdateResult> callback)
MongoCollection
replaceOne
in interface MongoCollection<TDocument>
filter
- the query filter to apply the the replace operationreplacement
- the replacement documentcallback
- the callback passed the result of the replace one operationpublic void replaceOne(Bson filter, TDocument replacement, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
MongoCollection
replaceOne
in interface MongoCollection<TDocument>
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 operationpublic void updateOne(Bson filter, Bson update, SingleResultCallback<UpdateResult> callback)
MongoCollection
updateOne
in interface MongoCollection<TDocument>
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 operationpublic void updateOne(Bson filter, Bson update, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
MongoCollection
updateOne
in interface MongoCollection<TDocument>
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 operationpublic void updateMany(Bson filter, Bson update, SingleResultCallback<UpdateResult> callback)
MongoCollection
updateMany
in interface MongoCollection<TDocument>
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 operationpublic void updateMany(Bson filter, Bson update, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
MongoCollection
updateMany
in interface MongoCollection<TDocument>
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 operationpublic void findOneAndDelete(Bson filter, SingleResultCallback<TDocument> callback)
MongoCollection
findOneAndDelete
in interface MongoCollection<TDocument>
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
returnedpublic void findOneAndDelete(Bson filter, FindOneAndDeleteOptions options, SingleResultCallback<TDocument> callback)
MongoCollection
findOneAndDelete
in interface MongoCollection<TDocument>
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
returnedpublic void findOneAndReplace(Bson filter, TDocument replacement, SingleResultCallback<TDocument> callback)
MongoCollection
findOneAndReplace
in interface MongoCollection<TDocument>
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 returnedpublic void findOneAndReplace(Bson filter, TDocument replacement, FindOneAndReplaceOptions options, SingleResultCallback<TDocument> callback)
MongoCollection
findOneAndReplace
in interface MongoCollection<TDocument>
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 returnedpublic void findOneAndUpdate(Bson filter, Bson update, SingleResultCallback<TDocument> callback)
MongoCollection
findOneAndUpdate
in interface MongoCollection<TDocument>
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 returnedpublic void findOneAndUpdate(Bson filter, Bson update, FindOneAndUpdateOptions options, SingleResultCallback<TDocument> callback)
MongoCollection
findOneAndUpdate
in interface MongoCollection<TDocument>
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 returnedpublic void drop(SingleResultCallback<java.lang.Void> callback)
MongoCollection
drop
in interface MongoCollection<TDocument>
callback
- the callback that is completed once the collection has been droppedpublic void createIndex(Bson key, SingleResultCallback<java.lang.String> callback)
MongoCollection
createIndex
in interface MongoCollection<TDocument>
key
- an object describing the index key(s), which may not be null.callback
- the callback that is completed once the index has been createdpublic void createIndex(Bson key, IndexOptions indexOptions, SingleResultCallback<java.lang.String> callback)
MongoCollection
createIndex
in interface MongoCollection<TDocument>
key
- an object describing the index key(s), which may not be null.indexOptions
- the options for the indexcallback
- the callback that is completed once the index has been createdpublic void createIndexes(java.util.List<IndexModel> indexes, SingleResultCallback<java.util.List<java.lang.String>> callback)
MongoCollection
createIndexes
in interface MongoCollection<TDocument>
indexes
- the list of indexescallback
- the callback that is completed once the indexes has been createdpublic ListIndexesIterable<Document> listIndexes()
MongoCollection
listIndexes
in interface MongoCollection<TDocument>
public <TResult> ListIndexesIterable<TResult> listIndexes(java.lang.Class<TResult> resultClass)
MongoCollection
listIndexes
in interface MongoCollection<TDocument>
TResult
- the target document type of the iterable.resultClass
- the class to decode each document intopublic void dropIndex(java.lang.String indexName, SingleResultCallback<java.lang.Void> callback)
MongoCollection
dropIndex
in interface MongoCollection<TDocument>
indexName
- the name of the index to removecallback
- the callback that is completed once the index has been droppedpublic void dropIndex(Bson keys, SingleResultCallback<java.lang.Void> callback)
MongoCollection
dropIndex
in interface MongoCollection<TDocument>
keys
- the keys of the index to removecallback
- the callback that is completed once the index has been droppedpublic void dropIndexes(SingleResultCallback<java.lang.Void> callback)
MongoCollection
dropIndexes
in interface MongoCollection<TDocument>
callback
- the callback that is completed once all the indexes have been droppedpublic void renameCollection(MongoNamespace newCollectionNamespace, SingleResultCallback<java.lang.Void> callback)
MongoCollection
renameCollection
in interface MongoCollection<TDocument>
newCollectionNamespace
- the namespace the collection will be renamed tocallback
- the callback that is completed once the collection has been renamedpublic void renameCollection(MongoNamespace newCollectionNamespace, RenameCollectionOptions options, SingleResultCallback<java.lang.Void> callback)
MongoCollection
renameCollection
in interface MongoCollection<TDocument>
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 renamedprivate void delete(Bson filter, DeleteOptions options, boolean multi, SingleResultCallback<DeleteResult> callback)
private void update(Bson filter, Bson update, UpdateOptions options, boolean multi, SingleResultCallback<UpdateResult> callback)
private void executeSingleWriteRequest(WriteRequest request, java.lang.Boolean bypassDocumentValidation, SingleResultCallback<BulkWriteResult> callback)
private WriteConcernResult translateBulkWriteResult(WriteRequest request, BulkWriteResult writeResult)
private UpdateResult toUpdateResult(BulkWriteResult result)
private <TResult> Codec<TResult> getCodec(java.lang.Class<TResult> resultClass)
private BsonDocument documentToBsonDocument(TDocument document)
private BsonDocument toBsonDocument(Bson document)