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 boolean |
retryWrites |
private WriteConcern |
writeConcern |
| Constructor and Description |
|---|
MongoCollectionImpl(MongoNamespace namespace,
java.lang.Class<TDocument> documentClass,
CodecRegistry codecRegistry,
ReadPreference readPreference,
WriteConcern writeConcern,
boolean retryWrites,
ReadConcern readConcern,
AsyncOperationExecutor executor) |
| Modifier and Type | Method and Description |
|---|---|
AggregateIterable<TDocument> |
aggregate(ClientSession clientSession,
java.util.List<? extends Bson> pipeline)
Aggregates documents according to the specified aggregation pipeline.
|
<TResult> AggregateIterable<TResult> |
aggregate(ClientSession clientSession,
java.util.List<? extends Bson> pipeline,
java.lang.Class<TResult> resultClass)
Aggregates documents according to the specified aggregation pipeline.
|
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(ClientSession clientSession,
java.util.List<? extends WriteModel<? extends TDocument>> requests,
BulkWriteOptions options,
SingleResultCallback<BulkWriteResult> callback)
Executes a mix of inserts, updates, replaces, and deletes.
|
void |
bulkWrite(ClientSession clientSession,
java.util.List<? extends WriteModel<? extends TDocument>> requests,
SingleResultCallback<BulkWriteResult> callback)
Executes a mix of inserts, updates, replaces, and deletes.
|
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(ClientSession clientSession,
Bson filter,
CountOptions options,
SingleResultCallback<java.lang.Long> callback)
Counts the number of documents in the collection according to the given options.
|
void |
count(ClientSession clientSession,
Bson filter,
SingleResultCallback<java.lang.Long> callback)
Counts the number of documents in the collection according to the given options.
|
void |
count(ClientSession clientSession,
SingleResultCallback<java.lang.Long> callback)
Counts the number of documents in the collection.
|
void |
count(SingleResultCallback<java.lang.Long> callback)
Counts the number of documents in the collection.
|
private <TResult> AggregateIterable<TResult> |
createAggregateIterable(ClientSession clientSession,
java.util.List<? extends Bson> pipeline,
java.lang.Class<TResult> resultClass) |
private <TResult> ChangeStreamIterable<TResult> |
createChangeStreamIterable(ClientSession clientSession,
java.util.List<? extends Bson> pipeline,
java.lang.Class<TResult> resultClass) |
private <TResult> DistinctIterable<TResult> |
createDistinctIterable(ClientSession clientSession,
java.lang.String fieldName,
Bson filter,
java.lang.Class<TResult> resultClass) |
private <TResult> FindIterable<TResult> |
createFindIterable(ClientSession clientSession,
Bson filter,
java.lang.Class<TResult> resultClass) |
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 |
createIndex(ClientSession clientSession,
Bson key,
IndexOptions indexOptions,
SingleResultCallback<java.lang.String> callback)
Creates an index.
|
void |
createIndex(ClientSession clientSession,
Bson key,
SingleResultCallback<java.lang.String> callback)
Creates an index.
|
void |
createIndexes(ClientSession clientSession,
java.util.List<IndexModel> indexes,
CreateIndexOptions createIndexOptions,
SingleResultCallback<java.util.List<java.lang.String>> callback)
Create multiple indexes.
|
void |
createIndexes(ClientSession clientSession,
java.util.List<IndexModel> indexes,
SingleResultCallback<java.util.List<java.lang.String>> callback)
Create multiple indexes.
|
void |
createIndexes(java.util.List<IndexModel> indexes,
CreateIndexOptions createIndexOptions,
SingleResultCallback<java.util.List<java.lang.String>> callback)
Create multiple indexes.
|
void |
createIndexes(java.util.List<IndexModel> indexes,
SingleResultCallback<java.util.List<java.lang.String>> callback)
Create multiple indexes.
|
private <TResult> ListIndexesIterable<TResult> |
createListIndexesIterable(ClientSession clientSession,
java.lang.Class<TResult> resultClass) |
private <TResult> MapReduceIterable<TResult> |
createMapReduceIterable(ClientSession clientSession,
java.lang.String mapFunction,
java.lang.String reduceFunction,
java.lang.Class<TResult> resultClass) |
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 |
deleteMany(ClientSession clientSession,
Bson filter,
DeleteOptions options,
SingleResultCallback<DeleteResult> callback)
Removes all documents from the collection that match the given query filter.
|
void |
deleteMany(ClientSession clientSession,
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.
|
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(ClientSession clientSession,
Bson filter,
SingleResultCallback<DeleteResult> callback)
Removes at most one document from the collection that matches the given filter.
|
<TResult> DistinctIterable<TResult> |
distinct(ClientSession clientSession,
java.lang.String fieldName,
Bson filter,
java.lang.Class<TResult> resultClass)
Gets the distinct values of the specified field name.
|
<TResult> DistinctIterable<TResult> |
distinct(ClientSession clientSession,
java.lang.String fieldName,
java.lang.Class<TResult> resultClass)
Gets the distinct values of the specified field name.
|
<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(ClientSession clientSession,
SingleResultCallback<java.lang.Void> callback)
Drops this collection from the Database.
|
void |
drop(SingleResultCallback<java.lang.Void> callback)
Drops this collection from the Database.
|
void |
dropIndex(Bson keys,
DropIndexOptions dropIndexOptions,
SingleResultCallback<java.lang.Void> callback)
Drops the index given the keys used to create it.
|
void |
dropIndex(Bson keys,
SingleResultCallback<java.lang.Void> callback)
Drops the index given the keys used to create it.
|
void |
dropIndex(ClientSession clientSession,
Bson keys,
DropIndexOptions dropIndexOptions,
SingleResultCallback<java.lang.Void> callback)
Drops the index given the keys used to create it.
|
void |
dropIndex(ClientSession clientSession,
Bson keys,
SingleResultCallback<java.lang.Void> callback)
Drops the index given the keys used to create it.
|
void |
dropIndex(ClientSession clientSession,
java.lang.String indexName,
DropIndexOptions dropIndexOptions,
SingleResultCallback<java.lang.Void> callback)
Drops the index given its name.
|
void |
dropIndex(ClientSession clientSession,
java.lang.String indexName,
SingleResultCallback<java.lang.Void> callback)
Drops the index given its name.
|
void |
dropIndex(java.lang.String indexName,
DropIndexOptions dropIndexOptions,
SingleResultCallback<java.lang.Void> callback)
Drops the index given its name.
|
void |
dropIndex(java.lang.String indexName,
SingleResultCallback<java.lang.Void> callback)
Drops the index given its name.
|
void |
dropIndexes(ClientSession clientSession,
DropIndexOptions dropIndexOptions,
SingleResultCallback<java.lang.Void> callback)
Drop all the indexes on this collection, except for the default on _id.
|
void |
dropIndexes(ClientSession clientSession,
SingleResultCallback<java.lang.Void> callback)
Drop all the indexes on this collection, except for the default on _id.
|
void |
dropIndexes(DropIndexOptions dropIndexOptions,
SingleResultCallback<java.lang.Void> callback)
Drop all the indexes on this collection, except for the default on _id.
|
void |
dropIndexes(SingleResultCallback<java.lang.Void> callback)
Drop all the indexes on this collection, except for the default on _id.
|
private void |
executeBulkWrite(ClientSession clientSession,
java.util.List<? extends WriteModel<? extends TDocument>> requests,
BulkWriteOptions options,
SingleResultCallback<BulkWriteResult> callback) |
private void |
executeCount(ClientSession clientSession,
Bson filter,
CountOptions options,
SingleResultCallback<java.lang.Long> callback) |
private void |
executeCreateIndexes(ClientSession clientSession,
java.util.List<IndexModel> indexes,
CreateIndexOptions createIndexOptions,
SingleResultCallback<java.util.List<java.lang.String>> callback) |
private void |
executeDelete(ClientSession clientSession,
Bson filter,
DeleteOptions options,
boolean multi,
SingleResultCallback<DeleteResult> callback) |
private void |
executeDrop(ClientSession clientSession,
SingleResultCallback<java.lang.Void> callback) |
private void |
executeDropIndex(ClientSession clientSession,
Bson keys,
DropIndexOptions dropIndexOptions,
SingleResultCallback<java.lang.Void> callback) |
private void |
executeDropIndex(ClientSession clientSession,
java.lang.String indexName,
DropIndexOptions dropIndexOptions,
SingleResultCallback<java.lang.Void> callback) |
private void |
executeFindOneAndDelete(ClientSession clientSession,
Bson filter,
FindOneAndDeleteOptions options,
SingleResultCallback<TDocument> callback) |
private void |
executeFindOneAndReplace(ClientSession clientSession,
Bson filter,
TDocument replacement,
FindOneAndReplaceOptions options,
SingleResultCallback<TDocument> callback) |
private void |
executeFindOneAndUpdate(ClientSession clientSession,
Bson filter,
Bson update,
FindOneAndUpdateOptions options,
SingleResultCallback<TDocument> callback) |
private void |
executeInsertMany(ClientSession clientSession,
java.util.List<? extends TDocument> documents,
InsertManyOptions options,
SingleResultCallback<java.lang.Void> callback) |
private void |
executeInsertOne(ClientSession clientSession,
TDocument document,
InsertOneOptions options,
SingleResultCallback<java.lang.Void> callback) |
private void |
executeRenameCollection(ClientSession clientSession,
MongoNamespace newCollectionNamespace,
RenameCollectionOptions options,
SingleResultCallback<java.lang.Void> callback) |
private void |
executeReplaceOne(ClientSession clientSession,
Bson filter,
TDocument replacement,
UpdateOptions options,
SingleResultCallback<UpdateResult> callback) |
private void |
executeSingleWriteRequest(ClientSession clientSession,
WriteRequest request,
java.lang.Boolean bypassDocumentValidation,
SingleResultCallback<BulkWriteResult> callback) |
private void |
executeUpdate(ClientSession clientSession,
Bson filter,
Bson update,
UpdateOptions options,
boolean multi,
SingleResultCallback<UpdateResult> 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.
|
FindIterable<TDocument> |
find(ClientSession clientSession)
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,
java.lang.Class<TResult> resultClass)
Finds all documents in the collection.
|
<TResult> FindIterable<TResult> |
find(ClientSession clientSession,
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 |
findOneAndDelete(ClientSession clientSession,
Bson filter,
FindOneAndDeleteOptions options,
SingleResultCallback<TDocument> callback)
Atomically find a document and remove it.
|
void |
findOneAndDelete(ClientSession clientSession,
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 |
findOneAndReplace(ClientSession clientSession,
Bson filter,
TDocument replacement,
FindOneAndReplaceOptions options,
SingleResultCallback<TDocument> callback)
Atomically find a document and replace it.
|
void |
findOneAndReplace(ClientSession clientSession,
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.
|
void |
findOneAndUpdate(ClientSession clientSession,
Bson filter,
Bson update,
FindOneAndUpdateOptions options,
SingleResultCallback<TDocument> callback)
Atomically find a document and update it.
|
void |
findOneAndUpdate(ClientSession clientSession,
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(ClientSession clientSession,
java.util.List<? extends TDocument> documents,
InsertManyOptions options,
SingleResultCallback<java.lang.Void> callback)
Inserts one or more documents.
|
void |
insertMany(ClientSession clientSession,
java.util.List<? extends TDocument> documents,
SingleResultCallback<java.lang.Void> callback)
Inserts one or more documents.
|
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(ClientSession clientSession,
TDocument document,
InsertOneOptions options,
SingleResultCallback<java.lang.Void> callback)
Inserts the provided document.
|
void |
insertOne(ClientSession clientSession,
TDocument document,
SingleResultCallback<java.lang.Void> callback)
Inserts the provided document.
|
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.
|
ListIndexesIterable<Document> |
listIndexes(ClientSession clientSession)
Get all the indexes in this collection.
|
<TResult> ListIndexesIterable<TResult> |
listIndexes(ClientSession clientSession,
java.lang.Class<TResult> resultClass)
Get all the indexes in this collection.
|
MapReduceIterable<TDocument> |
mapReduce(ClientSession clientSession,
java.lang.String mapFunction,
java.lang.String reduceFunction)
Aggregates documents according to the specified map-reduce function.
|
<TResult> MapReduceIterable<TResult> |
mapReduce(ClientSession clientSession,
java.lang.String mapFunction,
java.lang.String reduceFunction,
java.lang.Class<TResult> resultClass)
Aggregates documents according to the specified map-reduce function.
|
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(ClientSession clientSession,
MongoNamespace newCollectionNamespace,
RenameCollectionOptions options,
SingleResultCallback<java.lang.Void> callback)
Rename the collection with oldCollectionName to the newCollectionName.
|
void |
renameCollection(ClientSession clientSession,
MongoNamespace newCollectionNamespace,
SingleResultCallback<java.lang.Void> callback)
Rename the collection with oldCollectionName to the newCollectionName.
|
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.
|
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,
UpdateOptions options,
SingleResultCallback<UpdateResult> callback)
Replace a document in the collection according to the specified arguments.
|
private BsonDocument |
toBsonDocument(Bson document) |
private java.util.List<BsonDocument> |
toBsonDocumentList(java.util.List<? extends Bson> bsonList) |
private UpdateResult |
toUpdateResult(BulkWriteResult result) |
private WriteConcernResult |
translateBulkWriteResult(WriteRequest request,
BulkWriteResult writeResult) |
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 |
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 |
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.
|
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.
|
ChangeStreamIterable<TDocument> |
watch()
Creates a change stream for this collection.
|
<TResult> ChangeStreamIterable<TResult> |
watch(java.lang.Class<TResult> resultClass)
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,
java.lang.Class<TResult> resultClass)
Creates a change stream for this collection.
|
ChangeStreamIterable<TDocument> |
watch(ClientSession clientSession,
java.util.List<? extends Bson> pipeline)
Creates a change stream for this collection.
|
<TResult> ChangeStreamIterable<TResult> |
watch(ClientSession clientSession,
java.util.List<? extends Bson> pipeline,
java.lang.Class<TResult> resultClass)
Creates a change stream for this collection.
|
ChangeStreamIterable<TDocument> |
watch(java.util.List<? extends Bson> pipeline)
Creates a change stream for this collection.
|
<TResult> ChangeStreamIterable<TResult> |
watch(java.util.List<? extends Bson> pipeline,
java.lang.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(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 boolean retryWrites
private final ReadConcern readConcern
private final AsyncOperationExecutor executor
MongoCollectionImpl(MongoNamespace namespace, java.lang.Class<TDocument> documentClass, CodecRegistry codecRegistry, ReadPreference readPreference, WriteConcern writeConcern, boolean retryWrites, ReadConcern readConcern, AsyncOperationExecutor executor)
public MongoNamespace getNamespace()
MongoCollectiongetNamespace in interface MongoCollection<TDocument>public java.lang.Class<TDocument> getDocumentClass()
MongoCollectiongetDocumentClass in interface MongoCollection<TDocument>public CodecRegistry getCodecRegistry()
MongoCollectiongetCodecRegistry in interface MongoCollection<TDocument>CodecRegistrypublic ReadPreference getReadPreference()
MongoCollectiongetReadPreference in interface MongoCollection<TDocument>ReadPreferencepublic WriteConcern getWriteConcern()
MongoCollectiongetWriteConcern in interface MongoCollection<TDocument>WriteConcernpublic ReadConcern getReadConcern()
MongoCollectiongetReadConcern in interface MongoCollection<TDocument>ReadConcernpublic <NewTDocument> MongoCollection<NewTDocument> withDocumentClass(java.lang.Class<NewTDocument> newDocumentClass)
MongoCollectionwithDocumentClass 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)
MongoCollectionwithCodecRegistry in interface MongoCollection<TDocument>codecRegistry - the new CodecRegistry for the collectionpublic MongoCollection<TDocument> withReadPreference(ReadPreference readPreference)
MongoCollectionwithReadPreference in interface MongoCollection<TDocument>readPreference - the new ReadPreference for the collectionpublic MongoCollection<TDocument> withWriteConcern(WriteConcern writeConcern)
MongoCollectionwithWriteConcern in interface MongoCollection<TDocument>writeConcern - the new WriteConcern for the collectionpublic MongoCollection<TDocument> withReadConcern(ReadConcern readConcern)
MongoCollectionwithReadConcern in interface MongoCollection<TDocument>readConcern - the new ReadConcern for the collectionpublic void count(SingleResultCallback<java.lang.Long> callback)
MongoCollectioncount in interface MongoCollection<TDocument>callback - the callback passed the number of documents in the collectionpublic void count(Bson filter, SingleResultCallback<java.lang.Long> callback)
MongoCollectioncount 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)
MongoCollectioncount in interface MongoCollection<TDocument>filter - the query filteroptions - the options describing the countcallback - the callback passed the number of documents in the collectionpublic void count(ClientSession clientSession, SingleResultCallback<java.lang.Long> callback)
MongoCollectioncount in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationcallback - the callback passed the number of documents in the collectionpublic void count(ClientSession clientSession, Bson filter, SingleResultCallback<java.lang.Long> callback)
MongoCollectioncount in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationfilter - the query filtercallback - the callback passed the number of documents in the collectionpublic void count(ClientSession clientSession, Bson filter, CountOptions options, SingleResultCallback<java.lang.Long> callback)
MongoCollectioncount in interface MongoCollection<TDocument>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 collectionprivate void executeCount(ClientSession clientSession, Bson filter, CountOptions options, SingleResultCallback<java.lang.Long> callback)
public <TResult> DistinctIterable<TResult> distinct(java.lang.String fieldName, java.lang.Class<TResult> resultClass)
MongoCollectiondistinct 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)
MongoCollectiondistinct 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 <TResult> DistinctIterable<TResult> distinct(ClientSession clientSession, java.lang.String fieldName, java.lang.Class<TResult> resultClass)
MongoCollectiondistinct in interface MongoCollection<TDocument>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.public <TResult> DistinctIterable<TResult> distinct(ClientSession clientSession, java.lang.String fieldName, Bson filter, java.lang.Class<TResult> resultClass)
MongoCollectiondistinct in interface MongoCollection<TDocument>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.private <TResult> DistinctIterable<TResult> createDistinctIterable(ClientSession clientSession, java.lang.String fieldName, Bson filter, java.lang.Class<TResult> resultClass)
public FindIterable<TDocument> find()
MongoCollectionfind in interface MongoCollection<TDocument>public <TResult> FindIterable<TResult> find(java.lang.Class<TResult> resultClass)
MongoCollectionfind 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)
MongoCollectionfind in interface MongoCollection<TDocument>filter - the query filterpublic <TResult> FindIterable<TResult> find(Bson filter, java.lang.Class<TResult> resultClass)
MongoCollectionfind in interface MongoCollection<TDocument>TResult - the target document type of the iterable.filter - the query filterresultClass - the class to decode each document intopublic FindIterable<TDocument> find(ClientSession clientSession)
MongoCollectionfind in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationpublic <TResult> FindIterable<TResult> find(ClientSession clientSession, java.lang.Class<TResult> resultClass)
MongoCollectionfind in interface MongoCollection<TDocument>TResult - the target document type of the iterable.clientSession - the client session with which to associate this operationresultClass - the class to decode each document intopublic FindIterable<TDocument> find(ClientSession clientSession, Bson filter)
MongoCollectionfind in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationfilter - the query filterpublic <TResult> FindIterable<TResult> find(ClientSession clientSession, Bson filter, java.lang.Class<TResult> resultClass)
MongoCollectionfind in interface MongoCollection<TDocument>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 intoprivate <TResult> FindIterable<TResult> createFindIterable(ClientSession clientSession, Bson filter, java.lang.Class<TResult> resultClass)
public AggregateIterable<TDocument> aggregate(java.util.List<? extends Bson> pipeline)
MongoCollectionaggregate in interface MongoCollection<TDocument>pipeline - the aggregate pipelinepublic <TResult> AggregateIterable<TResult> aggregate(java.util.List<? extends Bson> pipeline, java.lang.Class<TResult> resultClass)
MongoCollectionaggregate in interface MongoCollection<TDocument>TResult - the target document type of the iterable.pipeline - the aggregate pipelineresultClass - the class to decode each document intopublic AggregateIterable<TDocument> aggregate(ClientSession clientSession, java.util.List<? extends Bson> pipeline)
MongoCollectionaggregate in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationpipeline - the aggregate pipelinepublic <TResult> AggregateIterable<TResult> aggregate(ClientSession clientSession, java.util.List<? extends Bson> pipeline, java.lang.Class<TResult> resultClass)
MongoCollectionaggregate in interface MongoCollection<TDocument>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 intoprivate <TResult> AggregateIterable<TResult> createAggregateIterable(ClientSession clientSession, java.util.List<? extends Bson> pipeline, java.lang.Class<TResult> resultClass)
public ChangeStreamIterable<TDocument> watch()
MongoCollectionwatch in interface MongoCollection<TDocument>public <TResult> ChangeStreamIterable<TResult> watch(java.lang.Class<TResult> resultClass)
MongoCollectionwatch in interface MongoCollection<TDocument>TResult - the target document type of the iterable.resultClass - the class to decode each document intopublic ChangeStreamIterable<TDocument> watch(java.util.List<? extends Bson> pipeline)
MongoCollectionwatch in interface MongoCollection<TDocument>pipeline - the aggregation pipeline to apply to the change streampublic <TResult> ChangeStreamIterable<TResult> watch(java.util.List<? extends Bson> pipeline, java.lang.Class<TResult> resultClass)
MongoCollectionwatch in interface MongoCollection<TDocument>TResult - the target document type of the iterable.pipeline - the aggregation pipeline to apply to the change streamresultClass - the class to decode each document intopublic ChangeStreamIterable<TDocument> watch(ClientSession clientSession)
MongoCollectionwatch in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationpublic <TResult> ChangeStreamIterable<TResult> watch(ClientSession clientSession, java.lang.Class<TResult> resultClass)
MongoCollectionwatch in interface MongoCollection<TDocument>TResult - the target document type of the iterable.clientSession - the client session with which to associate this operationresultClass - the class to decode each document intopublic ChangeStreamIterable<TDocument> watch(ClientSession clientSession, java.util.List<? extends Bson> pipeline)
MongoCollectionwatch in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationpipeline - the aggregation pipeline to apply to the change streampublic <TResult> ChangeStreamIterable<TResult> watch(ClientSession clientSession, java.util.List<? extends Bson> pipeline, java.lang.Class<TResult> resultClass)
MongoCollectionwatch in interface MongoCollection<TDocument>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 intoprivate <TResult> ChangeStreamIterable<TResult> createChangeStreamIterable(ClientSession clientSession, java.util.List<? extends Bson> pipeline, java.lang.Class<TResult> resultClass)
public MapReduceIterable<TDocument> mapReduce(java.lang.String mapFunction, java.lang.String reduceFunction)
MongoCollectionmapReduce 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)
MongoCollectionmapReduce 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 MapReduceIterable<TDocument> mapReduce(ClientSession clientSession, java.lang.String mapFunction, java.lang.String reduceFunction)
MongoCollectionmapReduce in interface MongoCollection<TDocument>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.public <TResult> MapReduceIterable<TResult> mapReduce(ClientSession clientSession, java.lang.String mapFunction, java.lang.String reduceFunction, java.lang.Class<TResult> resultClass)
MongoCollectionmapReduce in interface MongoCollection<TDocument>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.private <TResult> MapReduceIterable<TResult> createMapReduceIterable(ClientSession clientSession, java.lang.String mapFunction, java.lang.String reduceFunction, java.lang.Class<TResult> resultClass)
public void bulkWrite(java.util.List<? extends WriteModel<? extends TDocument>> requests, SingleResultCallback<BulkWriteResult> callback)
MongoCollectionbulkWrite 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)
MongoCollectionbulkWrite 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 bulkWrite(ClientSession clientSession, java.util.List<? extends WriteModel<? extends TDocument>> requests, SingleResultCallback<BulkWriteResult> callback)
MongoCollectionbulkWrite in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationrequests - the writes to executecallback - the callback passed the result of the bulk writepublic void bulkWrite(ClientSession clientSession, java.util.List<? extends WriteModel<? extends TDocument>> requests, BulkWriteOptions options, SingleResultCallback<BulkWriteResult> callback)
MongoCollectionbulkWrite in interface MongoCollection<TDocument>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 writeprivate void executeBulkWrite(ClientSession clientSession, java.util.List<? extends WriteModel<? extends TDocument>> requests, BulkWriteOptions options, SingleResultCallback<BulkWriteResult> callback)
public void insertOne(TDocument document, SingleResultCallback<java.lang.Void> callback)
MongoCollectioninsertOne 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)
MongoCollectioninsertOne 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 insertOne(ClientSession clientSession, TDocument document, SingleResultCallback<java.lang.Void> callback)
MongoCollectioninsertOne in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationdocument - the document to insertcallback - the callback that is completed once the insert has completedpublic void insertOne(ClientSession clientSession, TDocument document, InsertOneOptions options, SingleResultCallback<java.lang.Void> callback)
MongoCollectioninsertOne in interface MongoCollection<TDocument>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 completedprivate void executeInsertOne(ClientSession clientSession, TDocument document, InsertOneOptions options, SingleResultCallback<java.lang.Void> callback)
public void insertMany(java.util.List<? extends TDocument> documents, SingleResultCallback<java.lang.Void> callback)
MongoCollectionbulkWrite 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)
MongoCollectionbulkWrite 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 insertMany(ClientSession clientSession, java.util.List<? extends TDocument> documents, SingleResultCallback<java.lang.Void> callback)
MongoCollectionbulkWrite methodinsertMany in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationdocuments - 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(ClientSession clientSession, java.util.List<? extends TDocument> documents, InsertManyOptions options, SingleResultCallback<java.lang.Void> callback)
MongoCollectionbulkWrite methodinsertMany in interface MongoCollection<TDocument>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 completedMongoCollection.bulkWrite(java.util.List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>>, com.mongodb.async.SingleResultCallback<com.mongodb.bulk.BulkWriteResult>)private void executeInsertMany(ClientSession clientSession, java.util.List<? extends TDocument> documents, InsertManyOptions options, SingleResultCallback<java.lang.Void> callback)
public void deleteOne(Bson filter, SingleResultCallback<DeleteResult> callback)
MongoCollectiondeleteOne 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)
MongoCollectiondeleteOne 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 deleteOne(ClientSession clientSession, Bson filter, SingleResultCallback<DeleteResult> callback)
MongoCollectiondeleteOne in interface MongoCollection<TDocument>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 operationpublic void deleteOne(ClientSession clientSession, Bson filter, DeleteOptions options, SingleResultCallback<DeleteResult> callback)
MongoCollectiondeleteOne in interface MongoCollection<TDocument>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 operationpublic void deleteMany(Bson filter, SingleResultCallback<DeleteResult> callback)
MongoCollectiondeleteMany 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)
MongoCollectiondeleteMany 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 deleteMany(ClientSession clientSession, Bson filter, SingleResultCallback<DeleteResult> callback)
MongoCollectiondeleteMany in interface MongoCollection<TDocument>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 operationpublic void deleteMany(ClientSession clientSession, Bson filter, DeleteOptions options, SingleResultCallback<DeleteResult> callback)
MongoCollectiondeleteMany in interface MongoCollection<TDocument>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 operationprivate void executeDelete(ClientSession clientSession, Bson filter, DeleteOptions options, boolean multi, SingleResultCallback<DeleteResult> callback)
public void replaceOne(Bson filter, TDocument replacement, SingleResultCallback<UpdateResult> callback)
MongoCollectionreplaceOne 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)
MongoCollectionreplaceOne 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 replaceOne(ClientSession clientSession, Bson filter, TDocument replacement, SingleResultCallback<UpdateResult> callback)
MongoCollectionreplaceOne in interface MongoCollection<TDocument>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 operationpublic void replaceOne(ClientSession clientSession, Bson filter, TDocument replacement, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
MongoCollectionreplaceOne in interface MongoCollection<TDocument>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 operationprivate void executeReplaceOne(ClientSession clientSession, Bson filter, TDocument replacement, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
public void updateOne(Bson filter, Bson update, SingleResultCallback<UpdateResult> callback)
MongoCollectionupdateOne 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)
MongoCollectionupdateOne 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 updateOne(ClientSession clientSession, Bson filter, Bson update, SingleResultCallback<UpdateResult> callback)
MongoCollectionupdateOne in interface MongoCollection<TDocument>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 operationpublic void updateOne(ClientSession clientSession, Bson filter, Bson update, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
MongoCollectionupdateOne in interface MongoCollection<TDocument>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 operationpublic void updateMany(Bson filter, Bson update, SingleResultCallback<UpdateResult> callback)
MongoCollectionupdateMany 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)
MongoCollectionupdateMany 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 updateMany(ClientSession clientSession, Bson filter, Bson update, SingleResultCallback<UpdateResult> callback)
MongoCollectionupdateMany in interface MongoCollection<TDocument>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 operationpublic void updateMany(ClientSession clientSession, Bson filter, Bson update, UpdateOptions options, SingleResultCallback<UpdateResult> callback)
MongoCollectionupdateMany in interface MongoCollection<TDocument>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 operationprivate void executeUpdate(ClientSession clientSession, Bson filter, Bson update, UpdateOptions options, boolean multi, SingleResultCallback<UpdateResult> callback)
public void findOneAndDelete(Bson filter, SingleResultCallback<TDocument> callback)
MongoCollectionfindOneAndDelete 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)
MongoCollectionfindOneAndDelete 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 findOneAndDelete(ClientSession clientSession, Bson filter, SingleResultCallback<TDocument> callback)
MongoCollectionfindOneAndDelete in interface MongoCollection<TDocument>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
returnedpublic void findOneAndDelete(ClientSession clientSession, Bson filter, FindOneAndDeleteOptions options, SingleResultCallback<TDocument> callback)
MongoCollectionfindOneAndDelete in interface MongoCollection<TDocument>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
returnedprivate void executeFindOneAndDelete(ClientSession clientSession, Bson filter, FindOneAndDeleteOptions options, SingleResultCallback<TDocument> callback)
public void findOneAndReplace(Bson filter, TDocument replacement, SingleResultCallback<TDocument> callback)
MongoCollectionfindOneAndReplace 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)
MongoCollectionfindOneAndReplace 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 findOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement, SingleResultCallback<TDocument> callback)
MongoCollectionfindOneAndReplace in interface MongoCollection<TDocument>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 returnedpublic void findOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement, FindOneAndReplaceOptions options, SingleResultCallback<TDocument> callback)
MongoCollectionfindOneAndReplace in interface MongoCollection<TDocument>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 returnedprivate void executeFindOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement, FindOneAndReplaceOptions options, SingleResultCallback<TDocument> callback)
public void findOneAndUpdate(Bson filter, Bson update, SingleResultCallback<TDocument> callback)
MongoCollectionfindOneAndUpdate 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)
MongoCollectionfindOneAndUpdate 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 findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update, SingleResultCallback<TDocument> callback)
MongoCollectionfindOneAndUpdate in interface MongoCollection<TDocument>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 returnedpublic void findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update, FindOneAndUpdateOptions options, SingleResultCallback<TDocument> callback)
MongoCollectionfindOneAndUpdate in interface MongoCollection<TDocument>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 returnedprivate void executeFindOneAndUpdate(ClientSession clientSession, Bson filter, Bson update, FindOneAndUpdateOptions options, SingleResultCallback<TDocument> callback)
public void drop(SingleResultCallback<java.lang.Void> callback)
MongoCollectiondrop in interface MongoCollection<TDocument>callback - the callback that is completed once the collection has been droppedpublic void drop(ClientSession clientSession, SingleResultCallback<java.lang.Void> callback)
MongoCollectiondrop in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationcallback - the callback that is completed once the collection has been droppedprivate void executeDrop(ClientSession clientSession, SingleResultCallback<java.lang.Void> callback)
public void createIndex(Bson key, SingleResultCallback<java.lang.String> callback)
MongoCollectioncreateIndex 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)
MongoCollectioncreateIndex 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 createIndex(ClientSession clientSession, Bson key, SingleResultCallback<java.lang.String> callback)
MongoCollectioncreateIndex in interface MongoCollection<TDocument>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 createdpublic void createIndex(ClientSession clientSession, Bson key, IndexOptions indexOptions, SingleResultCallback<java.lang.String> callback)
MongoCollectioncreateIndex in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationkey - 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)
MongoCollectioncreateIndexes in interface MongoCollection<TDocument>indexes - the list of indexescallback - the callback that is completed once the indexes has been createdpublic void createIndexes(java.util.List<IndexModel> indexes, CreateIndexOptions createIndexOptions, SingleResultCallback<java.util.List<java.lang.String>> callback)
MongoCollectioncreateIndexes in interface MongoCollection<TDocument>indexes - the list of indexescreateIndexOptions - options to use when creating indexescallback - the callback that is completed once the indexes has been createdpublic void createIndexes(ClientSession clientSession, java.util.List<IndexModel> indexes, SingleResultCallback<java.util.List<java.lang.String>> callback)
MongoCollectioncreateIndexes in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationindexes - the list of indexescallback - the callback that is completed once the indexes has been createdpublic void createIndexes(ClientSession clientSession, java.util.List<IndexModel> indexes, CreateIndexOptions createIndexOptions, SingleResultCallback<java.util.List<java.lang.String>> callback)
MongoCollectioncreateIndexes in interface MongoCollection<TDocument>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 createdprivate void executeCreateIndexes(ClientSession clientSession, java.util.List<IndexModel> indexes, CreateIndexOptions createIndexOptions, SingleResultCallback<java.util.List<java.lang.String>> callback)
public ListIndexesIterable<Document> listIndexes()
MongoCollectionlistIndexes in interface MongoCollection<TDocument>public <TResult> ListIndexesIterable<TResult> listIndexes(java.lang.Class<TResult> resultClass)
MongoCollectionlistIndexes in interface MongoCollection<TDocument>TResult - the target document type of the iterable.resultClass - the class to decode each document intopublic ListIndexesIterable<Document> listIndexes(ClientSession clientSession)
MongoCollectionlistIndexes in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationpublic <TResult> ListIndexesIterable<TResult> listIndexes(ClientSession clientSession, java.lang.Class<TResult> resultClass)
MongoCollectionlistIndexes in interface MongoCollection<TDocument>TResult - the target document type of the iterable.clientSession - the client session with which to associate this operationresultClass - the class to decode each document intoprivate <TResult> ListIndexesIterable<TResult> createListIndexesIterable(ClientSession clientSession, java.lang.Class<TResult> resultClass)
public void dropIndex(java.lang.String indexName,
SingleResultCallback<java.lang.Void> callback)
MongoCollectiondropIndex 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(java.lang.String indexName,
DropIndexOptions dropIndexOptions,
SingleResultCallback<java.lang.Void> callback)
MongoCollectiondropIndex in interface MongoCollection<TDocument>indexName - the name of the index to removedropIndexOptions - options to use when dropping indexescallback - the callback that is completed once the index has been droppedpublic void dropIndex(Bson keys, SingleResultCallback<java.lang.Void> callback)
MongoCollectiondropIndex in interface MongoCollection<TDocument>keys - the keys of the index to removecallback - the callback that is completed once the index has been droppedpublic void dropIndex(Bson keys, DropIndexOptions dropIndexOptions, SingleResultCallback<java.lang.Void> callback)
MongoCollectiondropIndex in interface MongoCollection<TDocument>keys - the keys of the index to removedropIndexOptions - options to use when dropping indexescallback - the callback that is completed once the index has been droppedpublic void dropIndex(ClientSession clientSession, java.lang.String indexName, SingleResultCallback<java.lang.Void> callback)
MongoCollectiondropIndex in interface MongoCollection<TDocument>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 droppedpublic void dropIndex(ClientSession clientSession, java.lang.String indexName, DropIndexOptions dropIndexOptions, SingleResultCallback<java.lang.Void> callback)
MongoCollectiondropIndex in interface MongoCollection<TDocument>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 droppedpublic void dropIndex(ClientSession clientSession, Bson keys, SingleResultCallback<java.lang.Void> callback)
MongoCollectiondropIndex in interface MongoCollection<TDocument>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 droppedpublic void dropIndex(ClientSession clientSession, Bson keys, DropIndexOptions dropIndexOptions, SingleResultCallback<java.lang.Void> callback)
MongoCollectiondropIndex in interface MongoCollection<TDocument>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 droppedpublic void dropIndexes(SingleResultCallback<java.lang.Void> callback)
MongoCollectiondropIndexes in interface MongoCollection<TDocument>callback - the callback that is completed once all the indexes have been droppedpublic void dropIndexes(DropIndexOptions dropIndexOptions, SingleResultCallback<java.lang.Void> callback)
MongoCollectiondropIndexes in interface MongoCollection<TDocument>dropIndexOptions - options to use when dropping indexescallback - the callback that is completed once all the indexes have been droppedpublic void dropIndexes(ClientSession clientSession, SingleResultCallback<java.lang.Void> callback)
MongoCollectiondropIndexes in interface MongoCollection<TDocument>clientSession - the client session with which to associate this operationcallback - the callback that is completed once all the indexes have been droppedpublic void dropIndexes(ClientSession clientSession, DropIndexOptions dropIndexOptions, SingleResultCallback<java.lang.Void> callback)
MongoCollectiondropIndexes in interface MongoCollection<TDocument>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 droppedprivate void executeDropIndex(ClientSession clientSession, Bson keys, DropIndexOptions dropIndexOptions, SingleResultCallback<java.lang.Void> callback)
private void executeDropIndex(ClientSession clientSession, java.lang.String indexName, DropIndexOptions dropIndexOptions, SingleResultCallback<java.lang.Void> callback)
public void renameCollection(MongoNamespace newCollectionNamespace, SingleResultCallback<java.lang.Void> callback)
MongoCollectionrenameCollection 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)
MongoCollectionrenameCollection 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 renamedpublic void renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace, SingleResultCallback<java.lang.Void> callback)
MongoCollectionrenameCollection in interface MongoCollection<TDocument>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 renamedpublic void renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace, RenameCollectionOptions options, SingleResultCallback<java.lang.Void> callback)
MongoCollectionrenameCollection in interface MongoCollection<TDocument>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 renamedprivate void executeRenameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace, RenameCollectionOptions options, SingleResultCallback<java.lang.Void> callback)
private void executeSingleWriteRequest(ClientSession clientSession, 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)
private java.util.List<BsonDocument> toBsonDocumentList(java.util.List<? extends Bson> bsonList)