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 OperationExecutor |
executor |
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,
OperationExecutor 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.
|
BulkWriteResult |
bulkWrite(ClientSession clientSession,
java.util.List<? extends WriteModel<? extends TDocument>> requests)
Executes a mix of inserts, updates, replaces, and deletes.
|
BulkWriteResult |
bulkWrite(ClientSession clientSession,
java.util.List<? extends WriteModel<? extends TDocument>> requests,
BulkWriteOptions options)
Executes a mix of inserts, updates, replaces, and deletes.
|
BulkWriteResult |
bulkWrite(java.util.List<? extends WriteModel<? extends TDocument>> requests)
Executes a mix of inserts, updates, replaces, and deletes.
|
BulkWriteResult |
bulkWrite(java.util.List<? extends WriteModel<? extends TDocument>> requests,
BulkWriteOptions options)
Executes a mix of inserts, updates, replaces, and deletes.
|
long |
count()
Counts the number of documents in the collection.
|
long |
count(Bson filter)
Counts the number of documents in the collection according to the given options.
|
long |
count(Bson filter,
CountOptions options)
Counts the number of documents in the collection according to the given options.
|
long |
count(ClientSession clientSession)
Counts the number of documents in the collection.
|
long |
count(ClientSession clientSession,
Bson filter)
Counts the number of documents in the collection according to the given options.
|
long |
count(ClientSession clientSession,
Bson filter,
CountOptions options)
Counts the number of documents in the collection according to the given options.
|
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) |
java.lang.String |
createIndex(Bson keys)
Create an index with the given keys.
|
java.lang.String |
createIndex(Bson keys,
IndexOptions indexOptions)
Create an index with the given keys and options.
|
java.lang.String |
createIndex(ClientSession clientSession,
Bson keys)
Create an index with the given keys.
|
java.lang.String |
createIndex(ClientSession clientSession,
Bson keys,
IndexOptions indexOptions)
Create an index with the given keys and options.
|
java.util.List<java.lang.String> |
createIndexes(ClientSession clientSession,
java.util.List<IndexModel> indexes)
Create multiple indexes.
|
java.util.List<java.lang.String> |
createIndexes(ClientSession clientSession,
java.util.List<IndexModel> indexes,
CreateIndexOptions createIndexOptions)
Create multiple indexes.
|
java.util.List<java.lang.String> |
createIndexes(java.util.List<IndexModel> indexes)
Create multiple indexes.
|
java.util.List<java.lang.String> |
createIndexes(java.util.List<IndexModel> indexes,
CreateIndexOptions createIndexOptions)
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) |
DeleteResult |
deleteMany(Bson filter)
Removes all documents from the collection that match the given query filter.
|
DeleteResult |
deleteMany(Bson filter,
DeleteOptions options)
Removes all documents from the collection that match the given query filter.
|
DeleteResult |
deleteMany(ClientSession clientSession,
Bson filter)
Removes all documents from the collection that match the given query filter.
|
DeleteResult |
deleteMany(ClientSession clientSession,
Bson filter,
DeleteOptions options)
Removes all documents from the collection that match the given query filter.
|
DeleteResult |
deleteOne(Bson filter)
Removes at most one document from the collection that matches the given filter.
|
DeleteResult |
deleteOne(Bson filter,
DeleteOptions options)
Removes at most one document from the collection that matches the given filter.
|
DeleteResult |
deleteOne(ClientSession clientSession,
Bson filter)
Removes at most one document from the collection that matches the given filter.
|
DeleteResult |
deleteOne(ClientSession clientSession,
Bson filter,
DeleteOptions options)
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()
Drops this collection from the Database.
|
void |
drop(ClientSession clientSession)
Drops this collection from the Database.
|
void |
dropIndex(Bson keys)
Drops the index given the keys used to create it.
|
void |
dropIndex(Bson keys,
DropIndexOptions dropIndexOptions)
Drops the index given the keys used to create it.
|
void |
dropIndex(ClientSession clientSession,
Bson keys)
Drops the index given the keys used to create it.
|
void |
dropIndex(ClientSession clientSession,
Bson keys,
DropIndexOptions dropIndexOptions)
Drops the index given the keys used to create it.
|
void |
dropIndex(ClientSession clientSession,
java.lang.String indexName)
Drops the index given its name.
|
void |
dropIndex(ClientSession clientSession,
java.lang.String indexName,
DropIndexOptions dropIndexOptions)
Drops the index given its name.
|
void |
dropIndex(java.lang.String indexName)
Drops the index given its name.
|
void |
dropIndex(java.lang.String indexName,
DropIndexOptions dropIndexOptions)
Drops the index given its name.
|
void |
dropIndexes()
Drop all the indexes on this collection, except for the default on _id.
|
void |
dropIndexes(ClientSession clientSession)
Drop all the indexes on this collection, except for the default on _id.
|
void |
dropIndexes(ClientSession clientSession,
DropIndexOptions dropIndexOptions)
Drop all the indexes on this collection, except for the default on _id.
|
void |
dropIndexes(DropIndexOptions dropIndexOptions)
Drop all the indexes on this collection, except for the default on _id.
|
private BulkWriteResult |
executeBulkWrite(ClientSession clientSession,
java.util.List<? extends WriteModel<? extends TDocument>> requests,
BulkWriteOptions options) |
private long |
executeCount(ClientSession clientSession,
Bson filter,
CountOptions options) |
private java.util.List<java.lang.String> |
executeCreateIndexes(ClientSession clientSession,
java.util.List<IndexModel> indexes,
CreateIndexOptions createIndexOptions) |
private DeleteResult |
executeDelete(ClientSession clientSession,
Bson filter,
DeleteOptions deleteOptions,
boolean multi) |
private void |
executeDrop(ClientSession clientSession) |
private void |
executeDropIndex(ClientSession clientSession,
Bson keys,
DropIndexOptions dropIndexOptions) |
private void |
executeDropIndex(ClientSession clientSession,
java.lang.String indexName,
DropIndexOptions dropIndexOptions) |
private TDocument |
executeFindOneAndDelete(ClientSession clientSession,
Bson filter,
FindOneAndDeleteOptions options) |
private TDocument |
executeFindOneAndReplace(ClientSession clientSession,
Bson filter,
TDocument replacement,
FindOneAndReplaceOptions options) |
private TDocument |
executeFindOneAndUpdate(ClientSession clientSession,
Bson filter,
Bson update,
FindOneAndUpdateOptions options) |
private void |
executeInsertMany(ClientSession clientSession,
java.util.List<? extends TDocument> documents,
InsertManyOptions options) |
private void |
executeInsertOne(ClientSession clientSession,
TDocument document,
InsertOneOptions options) |
private void |
executeRenameCollection(ClientSession clientSession,
MongoNamespace newCollectionNamespace,
RenameCollectionOptions renameCollectionOptions) |
private UpdateResult |
executeReplaceOne(ClientSession clientSession,
Bson filter,
TDocument replacement,
UpdateOptions updateOptions) |
private BulkWriteResult |
executeSingleWriteRequest(ClientSession clientSession,
WriteRequest request,
java.lang.Boolean bypassDocumentValidation) |
private UpdateResult |
executeUpdate(ClientSession clientSession,
Bson filter,
Bson update,
UpdateOptions updateOptions,
boolean multi) |
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.
|
TDocument |
findOneAndDelete(Bson filter)
Atomically find a document and remove it.
|
TDocument |
findOneAndDelete(Bson filter,
FindOneAndDeleteOptions options)
Atomically find a document and remove it.
|
TDocument |
findOneAndDelete(ClientSession clientSession,
Bson filter)
Atomically find a document and remove it.
|
TDocument |
findOneAndDelete(ClientSession clientSession,
Bson filter,
FindOneAndDeleteOptions options)
Atomically find a document and remove it.
|
TDocument |
findOneAndReplace(Bson filter,
TDocument replacement)
Atomically find a document and replace it.
|
TDocument |
findOneAndReplace(Bson filter,
TDocument replacement,
FindOneAndReplaceOptions options)
Atomically find a document and replace it.
|
TDocument |
findOneAndReplace(ClientSession clientSession,
Bson filter,
TDocument replacement)
Atomically find a document and replace it.
|
TDocument |
findOneAndReplace(ClientSession clientSession,
Bson filter,
TDocument replacement,
FindOneAndReplaceOptions options)
Atomically find a document and replace it.
|
TDocument |
findOneAndUpdate(Bson filter,
Bson update)
Atomically find a document and update it.
|
TDocument |
findOneAndUpdate(Bson filter,
Bson update,
FindOneAndUpdateOptions options)
Atomically find a document and update it.
|
TDocument |
findOneAndUpdate(ClientSession clientSession,
Bson filter,
Bson update)
Atomically find a document and update it.
|
TDocument |
findOneAndUpdate(ClientSession clientSession,
Bson filter,
Bson update,
FindOneAndUpdateOptions options)
Atomically find a document and update it.
|
private Codec<TDocument> |
getCodec() |
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)
Inserts one or more documents.
|
void |
insertMany(ClientSession clientSession,
java.util.List<? extends TDocument> documents,
InsertManyOptions options)
Inserts one or more documents.
|
void |
insertMany(java.util.List<? extends TDocument> documents)
Inserts one or more documents.
|
void |
insertMany(java.util.List<? extends TDocument> documents,
InsertManyOptions options)
Inserts one or more documents.
|
void |
insertOne(ClientSession clientSession,
TDocument document)
Inserts the provided document.
|
void |
insertOne(ClientSession clientSession,
TDocument document,
InsertOneOptions options)
Inserts the provided document.
|
void |
insertOne(TDocument document)
Inserts the provided document.
|
void |
insertOne(TDocument document,
InsertOneOptions options)
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)
Rename the collection with oldCollectionName to the newCollectionName.
|
void |
renameCollection(ClientSession clientSession,
MongoNamespace newCollectionNamespace,
RenameCollectionOptions renameCollectionOptions)
Rename the collection with oldCollectionName to the newCollectionName.
|
void |
renameCollection(MongoNamespace newCollectionNamespace)
Rename the collection with oldCollectionName to the newCollectionName.
|
void |
renameCollection(MongoNamespace newCollectionNamespace,
RenameCollectionOptions renameCollectionOptions)
Rename the collection with oldCollectionName to the newCollectionName.
|
UpdateResult |
replaceOne(Bson filter,
TDocument replacement)
Replace a document in the collection according to the specified arguments.
|
UpdateResult |
replaceOne(Bson filter,
TDocument replacement,
UpdateOptions updateOptions)
Replace a document in the collection according to the specified arguments.
|
UpdateResult |
replaceOne(ClientSession clientSession,
Bson filter,
TDocument replacement)
Replace a document in the collection according to the specified arguments.
|
UpdateResult |
replaceOne(ClientSession clientSession,
Bson filter,
TDocument replacement,
UpdateOptions updateOptions)
Replace a document in the collection according to the specified arguments.
|
private BsonDocument |
toBsonDocument(Bson bson) |
private java.util.List<BsonDocument> |
toBsonDocumentList(java.util.List<? extends Bson> bsonList) |
private UpdateResult |
toUpdateResult(BulkWriteResult result) |
private WriteConcernResult |
translateBulkWriteResult(WriteRequest request,
BulkWriteResult writeResult) |
UpdateResult |
updateMany(Bson filter,
Bson update)
Update all documents in the collection according to the specified arguments.
|
UpdateResult |
updateMany(Bson filter,
Bson update,
UpdateOptions updateOptions)
Update all documents in the collection according to the specified arguments.
|
UpdateResult |
updateMany(ClientSession clientSession,
Bson filter,
Bson update)
Update all documents in the collection according to the specified arguments.
|
UpdateResult |
updateMany(ClientSession clientSession,
Bson filter,
Bson update,
UpdateOptions updateOptions)
Update all documents in the collection according to the specified arguments.
|
UpdateResult |
updateOne(Bson filter,
Bson update)
Update a single document in the collection according to the specified arguments.
|
UpdateResult |
updateOne(Bson filter,
Bson update,
UpdateOptions updateOptions)
Update a single document in the collection according to the specified arguments.
|
UpdateResult |
updateOne(ClientSession clientSession,
Bson filter,
Bson update)
Update a single document in the collection according to the specified arguments.
|
UpdateResult |
updateOne(ClientSession clientSession,
Bson filter,
Bson update,
UpdateOptions updateOptions)
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> clazz)
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 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 OperationExecutor executor
MongoCollectionImpl(MongoNamespace namespace, java.lang.Class<TDocument> documentClass, CodecRegistry codecRegistry, ReadPreference readPreference, WriteConcern writeConcern, boolean retryWrites, ReadConcern readConcern, OperationExecutor 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> clazz)
MongoCollection
withDocumentClass
in interface MongoCollection<TDocument>
NewTDocument
- The type that the new collection will encode documents from and decode documents toclazz
- 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 long count()
MongoCollection
count
in interface MongoCollection<TDocument>
public long count(Bson filter)
MongoCollection
count
in interface MongoCollection<TDocument>
filter
- the query filterpublic long count(Bson filter, CountOptions options)
MongoCollection
count
in interface MongoCollection<TDocument>
filter
- the query filteroptions
- the options describing the countpublic long count(ClientSession clientSession)
MongoCollection
count
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationpublic long count(ClientSession clientSession, Bson filter)
MongoCollection
count
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationfilter
- the query filterpublic long count(ClientSession clientSession, Bson filter, CountOptions options)
MongoCollection
count
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationfilter
- the query filteroptions
- the options describing the countprivate long executeCount(ClientSession clientSession, Bson filter, CountOptions options)
public <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 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 class to cast any distinct items into.public <TResult> DistinctIterable<TResult> distinct(ClientSession clientSession, java.lang.String fieldName, java.lang.Class<TResult> resultClass)
MongoCollection
distinct
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 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)
MongoCollection
distinct
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 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()
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 FindIterable<TDocument> find(ClientSession clientSession)
MongoCollection
find
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)
MongoCollection
find
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)
MongoCollection
find
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)
MongoCollection
find
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)
MongoCollection
aggregate
in interface MongoCollection<TDocument>
pipeline
- the aggregation 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 aggregation pipelineresultClass
- the class to decode each document intopublic AggregateIterable<TDocument> aggregate(ClientSession clientSession, java.util.List<? extends Bson> pipeline)
MongoCollection
aggregate
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationpipeline
- the aggregation pipelinepublic <TResult> AggregateIterable<TResult> aggregate(ClientSession clientSession, 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.clientSession
- the client session with which to associate this operationpipeline
- the aggregation 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()
MongoCollection
watch
in interface MongoCollection<TDocument>
public <TResult> ChangeStreamIterable<TResult> watch(java.lang.Class<TResult> resultClass)
MongoCollection
watch
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)
MongoCollection
watch
in interface MongoCollection<TDocument>
pipeline
- the aggregation pipeline to apply to the change stream.public <TResult> ChangeStreamIterable<TResult> watch(java.util.List<? extends Bson> pipeline, java.lang.Class<TResult> resultClass)
MongoCollection
watch
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)
MongoCollection
watch
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)
MongoCollection
watch
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)
MongoCollection
watch
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationpipeline
- the aggregation pipeline to apply to the change stream.public <TResult> ChangeStreamIterable<TResult> watch(ClientSession clientSession, java.util.List<? extends Bson> pipeline, java.lang.Class<TResult> resultClass)
MongoCollection
watch
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)
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 MapReduceIterable<TDocument> mapReduce(ClientSession clientSession, java.lang.String mapFunction, java.lang.String reduceFunction)
MongoCollection
mapReduce
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)
MongoCollection
mapReduce
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 BulkWriteResult bulkWrite(java.util.List<? extends WriteModel<? extends TDocument>> requests)
MongoCollection
bulkWrite
in interface MongoCollection<TDocument>
requests
- the writes to executepublic BulkWriteResult bulkWrite(java.util.List<? extends WriteModel<? extends TDocument>> requests, BulkWriteOptions options)
MongoCollection
bulkWrite
in interface MongoCollection<TDocument>
requests
- the writes to executeoptions
- the options to apply to the bulk write operationpublic BulkWriteResult bulkWrite(ClientSession clientSession, java.util.List<? extends WriteModel<? extends TDocument>> requests)
MongoCollection
bulkWrite
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationrequests
- the writes to executepublic BulkWriteResult bulkWrite(ClientSession clientSession, java.util.List<? extends WriteModel<? extends TDocument>> requests, BulkWriteOptions options)
MongoCollection
bulkWrite
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 operationprivate BulkWriteResult executeBulkWrite(ClientSession clientSession, java.util.List<? extends WriteModel<? extends TDocument>> requests, BulkWriteOptions options)
public void insertOne(TDocument document)
MongoCollection
insertOne
in interface MongoCollection<TDocument>
document
- the document to insertpublic void insertOne(TDocument document, InsertOneOptions options)
MongoCollection
insertOne
in interface MongoCollection<TDocument>
document
- the document to insertoptions
- the options to apply to the operationpublic void insertOne(ClientSession clientSession, TDocument document)
MongoCollection
insertOne
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationdocument
- the document to insertpublic void insertOne(ClientSession clientSession, TDocument document, InsertOneOptions options)
MongoCollection
insertOne
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationdocument
- the document to insertoptions
- the options to apply to the operationprivate void executeInsertOne(ClientSession clientSession, TDocument document, InsertOneOptions options)
public void insertMany(java.util.List<? extends TDocument> documents)
MongoCollection
bulkWrite
methodinsertMany
in interface MongoCollection<TDocument>
documents
- the documents to insertMongoCollection.bulkWrite(java.util.List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>>)
public void insertMany(java.util.List<? extends TDocument> documents, InsertManyOptions options)
MongoCollection
bulkWrite
methodinsertMany
in interface MongoCollection<TDocument>
documents
- the documents to insertoptions
- the options to apply to the operationpublic void insertMany(ClientSession clientSession, java.util.List<? extends TDocument> documents)
MongoCollection
bulkWrite
methodinsertMany
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationdocuments
- the documents to insertMongoCollection.bulkWrite(java.util.List<? extends com.mongodb.client.model.WriteModel<? extends TDocument>>)
public void insertMany(ClientSession clientSession, java.util.List<? extends TDocument> documents, InsertManyOptions options)
MongoCollection
bulkWrite
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 operationprivate void executeInsertMany(ClientSession clientSession, java.util.List<? extends TDocument> documents, InsertManyOptions options)
public DeleteResult deleteOne(Bson filter)
MongoCollection
deleteOne
in interface MongoCollection<TDocument>
filter
- the query filter to apply the the delete operationpublic DeleteResult deleteOne(Bson filter, DeleteOptions options)
MongoCollection
deleteOne
in interface MongoCollection<TDocument>
filter
- the query filter to apply the the delete operationoptions
- the options to apply to the delete operationpublic DeleteResult deleteOne(ClientSession clientSession, Bson filter)
MongoCollection
deleteOne
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the delete operationpublic DeleteResult deleteOne(ClientSession clientSession, Bson filter, DeleteOptions options)
MongoCollection
deleteOne
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 operationpublic DeleteResult deleteMany(Bson filter)
MongoCollection
deleteMany
in interface MongoCollection<TDocument>
filter
- the query filter to apply the the delete operationpublic DeleteResult deleteMany(Bson filter, DeleteOptions options)
MongoCollection
deleteMany
in interface MongoCollection<TDocument>
filter
- the query filter to apply the the delete operationoptions
- the options to apply to the delete operationpublic DeleteResult deleteMany(ClientSession clientSession, Bson filter)
MongoCollection
deleteMany
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the delete operationpublic DeleteResult deleteMany(ClientSession clientSession, Bson filter, DeleteOptions options)
MongoCollection
deleteMany
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 operationpublic UpdateResult replaceOne(Bson filter, TDocument replacement)
MongoCollection
replaceOne
in interface MongoCollection<TDocument>
filter
- the query filter to apply the the replace operationreplacement
- the replacement documentpublic UpdateResult replaceOne(Bson filter, TDocument replacement, UpdateOptions updateOptions)
MongoCollection
replaceOne
in interface MongoCollection<TDocument>
filter
- the query filter to apply the the replace operationreplacement
- the replacement documentupdateOptions
- the options to apply to the replace operationpublic UpdateResult replaceOne(ClientSession clientSession, Bson filter, TDocument replacement)
MongoCollection
replaceOne
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 documentpublic UpdateResult replaceOne(ClientSession clientSession, Bson filter, TDocument replacement, UpdateOptions updateOptions)
MongoCollection
replaceOne
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 documentupdateOptions
- the options to apply to the replace operationprivate UpdateResult executeReplaceOne(ClientSession clientSession, Bson filter, TDocument replacement, UpdateOptions updateOptions)
public UpdateResult updateOne(Bson filter, Bson update)
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.public UpdateResult updateOne(Bson filter, Bson update, UpdateOptions updateOptions)
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.updateOptions
- the options to apply to the update operationpublic UpdateResult updateOne(ClientSession clientSession, Bson filter, Bson update)
MongoCollection
updateOne
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.public UpdateResult updateOne(ClientSession clientSession, Bson filter, Bson update, UpdateOptions updateOptions)
MongoCollection
updateOne
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.updateOptions
- the options to apply to the update operationpublic UpdateResult updateMany(Bson filter, Bson update)
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.public UpdateResult updateMany(Bson filter, Bson update, UpdateOptions updateOptions)
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.updateOptions
- the options to apply to the update operationpublic UpdateResult updateMany(ClientSession clientSession, Bson filter, Bson update)
MongoCollection
updateMany
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.public UpdateResult updateMany(ClientSession clientSession, Bson filter, Bson update, UpdateOptions updateOptions)
MongoCollection
updateMany
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.updateOptions
- the options to apply to the update operationpublic TDocument findOneAndDelete(Bson filter)
MongoCollection
findOneAndDelete
in interface MongoCollection<TDocument>
filter
- the query filter to find the document withpublic TDocument findOneAndDelete(Bson filter, FindOneAndDeleteOptions options)
MongoCollection
findOneAndDelete
in interface MongoCollection<TDocument>
filter
- the query filter to find the document withoptions
- the options to apply to the operationpublic TDocument findOneAndDelete(ClientSession clientSession, Bson filter)
MongoCollection
findOneAndDelete
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationfilter
- the query filter to find the document withpublic TDocument findOneAndDelete(ClientSession clientSession, Bson filter, FindOneAndDeleteOptions options)
MongoCollection
findOneAndDelete
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 operationprivate TDocument executeFindOneAndDelete(ClientSession clientSession, Bson filter, FindOneAndDeleteOptions options)
public TDocument findOneAndReplace(Bson filter, TDocument replacement)
MongoCollection
findOneAndReplace
in interface MongoCollection<TDocument>
filter
- the query filter to apply the the replace operationreplacement
- the replacement documentreturnOriginal
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 TDocument findOneAndReplace(Bson filter, TDocument replacement, FindOneAndReplaceOptions options)
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 operationreturnOriginal
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 TDocument findOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement)
MongoCollection
findOneAndReplace
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 documentreturnOriginal
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 TDocument findOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement, FindOneAndReplaceOptions options)
MongoCollection
findOneAndReplace
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 operationreturnOriginal
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 TDocument executeFindOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement, FindOneAndReplaceOptions options)
public TDocument findOneAndUpdate(Bson filter, Bson update)
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.public TDocument findOneAndUpdate(Bson filter, Bson update, FindOneAndUpdateOptions options)
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 operationreturnOriginal
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 TDocument findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update)
MongoCollection
findOneAndUpdate
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.public TDocument findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update, FindOneAndUpdateOptions options)
MongoCollection
findOneAndUpdate
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 operationreturnOriginal
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 TDocument executeFindOneAndUpdate(ClientSession clientSession, Bson filter, Bson update, FindOneAndUpdateOptions options)
public void drop()
MongoCollection
drop
in interface MongoCollection<TDocument>
public void drop(ClientSession clientSession)
MongoCollection
drop
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationprivate void executeDrop(ClientSession clientSession)
public java.lang.String createIndex(Bson keys)
MongoCollection
createIndex
in interface MongoCollection<TDocument>
keys
- an object describing the index key(s), which may not be null.public java.lang.String createIndex(Bson keys, IndexOptions indexOptions)
MongoCollection
createIndex
in interface MongoCollection<TDocument>
keys
- an object describing the index key(s), which may not be null.indexOptions
- the options for the indexpublic java.lang.String createIndex(ClientSession clientSession, Bson keys)
MongoCollection
createIndex
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationkeys
- an object describing the index key(s), which may not be null.public java.lang.String createIndex(ClientSession clientSession, Bson keys, IndexOptions indexOptions)
MongoCollection
createIndex
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationkeys
- an object describing the index key(s), which may not be null.indexOptions
- the options for the indexpublic java.util.List<java.lang.String> createIndexes(java.util.List<IndexModel> indexes)
MongoCollection
createIndexes
in interface MongoCollection<TDocument>
indexes
- the list of indexespublic java.util.List<java.lang.String> createIndexes(java.util.List<IndexModel> indexes, CreateIndexOptions createIndexOptions)
MongoCollection
createIndexes
in interface MongoCollection<TDocument>
indexes
- the list of indexescreateIndexOptions
- options to use when creating indexespublic java.util.List<java.lang.String> createIndexes(ClientSession clientSession, java.util.List<IndexModel> indexes)
MongoCollection
createIndexes
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationindexes
- the list of indexespublic java.util.List<java.lang.String> createIndexes(ClientSession clientSession, java.util.List<IndexModel> indexes, CreateIndexOptions createIndexOptions)
MongoCollection
createIndexes
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationindexes
- the list of indexescreateIndexOptions
- options to use when creating indexesprivate java.util.List<java.lang.String> executeCreateIndexes(ClientSession clientSession, java.util.List<IndexModel> indexes, CreateIndexOptions createIndexOptions)
public 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 ListIndexesIterable<Document> listIndexes(ClientSession clientSession)
MongoCollection
listIndexes
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)
MongoCollection
listIndexes
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)
MongoCollection
dropIndex
in interface MongoCollection<TDocument>
indexName
- the name of the index to removepublic void dropIndex(java.lang.String indexName, DropIndexOptions dropIndexOptions)
MongoCollection
dropIndex
in interface MongoCollection<TDocument>
indexName
- the name of the index to removedropIndexOptions
- the options to use when dropping indexespublic void dropIndex(Bson keys)
MongoCollection
dropIndex
in interface MongoCollection<TDocument>
keys
- the keys of the index to removepublic void dropIndex(Bson keys, DropIndexOptions dropIndexOptions)
MongoCollection
dropIndex
in interface MongoCollection<TDocument>
keys
- the keys of the index to removedropIndexOptions
- the options to use when dropping indexespublic void dropIndex(ClientSession clientSession, java.lang.String indexName)
MongoCollection
dropIndex
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationindexName
- the name of the index to removepublic void dropIndex(ClientSession clientSession, Bson keys)
MongoCollection
dropIndex
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationkeys
- the keys of the index to removepublic void dropIndex(ClientSession clientSession, java.lang.String indexName, DropIndexOptions dropIndexOptions)
MongoCollection
dropIndex
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationindexName
- the name of the index to removedropIndexOptions
- the options to use when dropping indexespublic void dropIndex(ClientSession clientSession, Bson keys, DropIndexOptions dropIndexOptions)
MongoCollection
dropIndex
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationkeys
- the keys of the index to removedropIndexOptions
- the options to use when dropping indexespublic void dropIndexes()
MongoCollection
dropIndexes
in interface MongoCollection<TDocument>
public void dropIndexes(ClientSession clientSession)
MongoCollection
dropIndexes
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationpublic void dropIndexes(DropIndexOptions dropIndexOptions)
MongoCollection
dropIndexes
in interface MongoCollection<TDocument>
dropIndexOptions
- the options to use when dropping indexespublic void dropIndexes(ClientSession clientSession, DropIndexOptions dropIndexOptions)
MongoCollection
dropIndexes
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationdropIndexOptions
- the options to use when dropping indexesprivate void executeDropIndex(ClientSession clientSession, java.lang.String indexName, DropIndexOptions dropIndexOptions)
private void executeDropIndex(ClientSession clientSession, Bson keys, DropIndexOptions dropIndexOptions)
public void renameCollection(MongoNamespace newCollectionNamespace)
MongoCollection
renameCollection
in interface MongoCollection<TDocument>
newCollectionNamespace
- the namespace the collection will be renamed topublic void renameCollection(MongoNamespace newCollectionNamespace, RenameCollectionOptions renameCollectionOptions)
MongoCollection
renameCollection
in interface MongoCollection<TDocument>
newCollectionNamespace
- the name the collection will be renamed torenameCollectionOptions
- the options for renaming a collectionpublic void renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace)
MongoCollection
renameCollection
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationnewCollectionNamespace
- the namespace the collection will be renamed topublic void renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace, RenameCollectionOptions renameCollectionOptions)
MongoCollection
renameCollection
in interface MongoCollection<TDocument>
clientSession
- the client session with which to associate this operationnewCollectionNamespace
- the name the collection will be renamed torenameCollectionOptions
- the options for renaming a collectionprivate void executeRenameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace, RenameCollectionOptions renameCollectionOptions)
private DeleteResult executeDelete(ClientSession clientSession, Bson filter, DeleteOptions deleteOptions, boolean multi)
private UpdateResult executeUpdate(ClientSession clientSession, Bson filter, Bson update, UpdateOptions updateOptions, boolean multi)
private BulkWriteResult executeSingleWriteRequest(ClientSession clientSession, WriteRequest request, java.lang.Boolean bypassDocumentValidation)
private WriteConcernResult translateBulkWriteResult(WriteRequest request, BulkWriteResult writeResult)
private UpdateResult toUpdateResult(BulkWriteResult result)
private BsonDocument documentToBsonDocument(TDocument document)
private BsonDocument toBsonDocument(Bson bson)
private java.util.List<BsonDocument> toBsonDocumentList(java.util.List<? extends Bson> bsonList)