TDocument
- The type that this collection will encode documents from and decode documents to.@ThreadSafe public interface MongoCollection<TDocument>
Note: Additions to this interface will not be considered to break binary compatibility.
Modifier and Type | Method and Description |
---|---|
AggregatePublisher<Document> |
aggregate(ClientSession clientSession,
List<? extends Bson> pipeline)
Aggregates documents according to the specified aggregation pipeline.
|
<TResult> AggregatePublisher<TResult> |
aggregate(ClientSession clientSession,
List<? extends Bson> pipeline,
Class<TResult> clazz)
Aggregates documents according to the specified aggregation pipeline.
|
AggregatePublisher<Document> |
aggregate(List<? extends Bson> pipeline)
Aggregates documents according to the specified aggregation pipeline.
|
<TResult> AggregatePublisher<TResult> |
aggregate(List<? extends Bson> pipeline,
Class<TResult> clazz)
Aggregates documents according to the specified aggregation pipeline.
|
org.reactivestreams.Publisher<BulkWriteResult> |
bulkWrite(ClientSession clientSession,
List<? extends WriteModel<? extends TDocument>> requests)
Executes a mix of inserts, updates, replaces, and deletes.
|
org.reactivestreams.Publisher<BulkWriteResult> |
bulkWrite(ClientSession clientSession,
List<? extends WriteModel<? extends TDocument>> requests,
BulkWriteOptions options)
Executes a mix of inserts, updates, replaces, and deletes.
|
org.reactivestreams.Publisher<BulkWriteResult> |
bulkWrite(List<? extends WriteModel<? extends TDocument>> requests)
Executes a mix of inserts, updates, replaces, and deletes.
|
org.reactivestreams.Publisher<BulkWriteResult> |
bulkWrite(List<? extends WriteModel<? extends TDocument>> requests,
BulkWriteOptions options)
Executes a mix of inserts, updates, replaces, and deletes.
|
org.reactivestreams.Publisher<Long> |
count()
Deprecated.
use
countDocuments() or estimatedDocumentCount() instead |
org.reactivestreams.Publisher<Long> |
count(Bson filter)
Deprecated.
Use
countDocuments(Bson) instead |
org.reactivestreams.Publisher<Long> |
count(Bson filter,
CountOptions options)
Deprecated.
Use
countDocuments(Bson, CountOptions) instead |
org.reactivestreams.Publisher<Long> |
count(ClientSession clientSession)
Deprecated.
Use
countDocuments(ClientSession) instead |
org.reactivestreams.Publisher<Long> |
count(ClientSession clientSession,
Bson filter)
Deprecated.
Use
countDocuments(ClientSession, Bson) instead |
org.reactivestreams.Publisher<Long> |
count(ClientSession clientSession,
Bson filter,
CountOptions options)
Deprecated.
|
org.reactivestreams.Publisher<Long> |
countDocuments()
Counts the number of documents in the collection.
|
org.reactivestreams.Publisher<Long> |
countDocuments(Bson filter)
Counts the number of documents in the collection according to the given options.
|
org.reactivestreams.Publisher<Long> |
countDocuments(Bson filter,
CountOptions options)
Counts the number of documents in the collection according to the given options.
|
org.reactivestreams.Publisher<Long> |
countDocuments(ClientSession clientSession)
Counts the number of documents in the collection.
|
org.reactivestreams.Publisher<Long> |
countDocuments(ClientSession clientSession,
Bson filter)
Counts the number of documents in the collection according to the given options.
|
org.reactivestreams.Publisher<Long> |
countDocuments(ClientSession clientSession,
Bson filter,
CountOptions options)
Counts the number of documents in the collection according to the given options.
|
org.reactivestreams.Publisher<String> |
createIndex(Bson key)
Creates an index.
|
org.reactivestreams.Publisher<String> |
createIndex(Bson key,
IndexOptions options)
Creates an index.
|
org.reactivestreams.Publisher<String> |
createIndex(ClientSession clientSession,
Bson key)
Creates an index.
|
org.reactivestreams.Publisher<String> |
createIndex(ClientSession clientSession,
Bson key,
IndexOptions options)
Creates an index.
|
org.reactivestreams.Publisher<String> |
createIndexes(ClientSession clientSession,
List<IndexModel> indexes)
Create multiple indexes.
|
org.reactivestreams.Publisher<String> |
createIndexes(ClientSession clientSession,
List<IndexModel> indexes,
CreateIndexOptions createIndexOptions)
Create multiple indexes.
|
org.reactivestreams.Publisher<String> |
createIndexes(List<IndexModel> indexes)
Create multiple indexes.
|
org.reactivestreams.Publisher<String> |
createIndexes(List<IndexModel> indexes,
CreateIndexOptions createIndexOptions)
Create multiple indexes.
|
org.reactivestreams.Publisher<DeleteResult> |
deleteMany(Bson filter)
Removes all documents from the collection that match the given query filter.
|
org.reactivestreams.Publisher<DeleteResult> |
deleteMany(Bson filter,
DeleteOptions options)
Removes all documents from the collection that match the given query filter.
|
org.reactivestreams.Publisher<DeleteResult> |
deleteMany(ClientSession clientSession,
Bson filter)
Removes all documents from the collection that match the given query filter.
|
org.reactivestreams.Publisher<DeleteResult> |
deleteMany(ClientSession clientSession,
Bson filter,
DeleteOptions options)
Removes all documents from the collection that match the given query filter.
|
org.reactivestreams.Publisher<DeleteResult> |
deleteOne(Bson filter)
Removes at most one document from the collection that matches the given filter.
|
org.reactivestreams.Publisher<DeleteResult> |
deleteOne(Bson filter,
DeleteOptions options)
Removes at most one document from the collection that matches the given filter.
|
org.reactivestreams.Publisher<DeleteResult> |
deleteOne(ClientSession clientSession,
Bson filter)
Removes at most one document from the collection that matches the given filter.
|
org.reactivestreams.Publisher<DeleteResult> |
deleteOne(ClientSession clientSession,
Bson filter,
DeleteOptions options)
Removes at most one document from the collection that matches the given filter.
|
<TResult> DistinctPublisher<TResult> |
distinct(ClientSession clientSession,
String fieldName,
Bson filter,
Class<TResult> resultClass)
Gets the distinct values of the specified field name.
|
<TResult> DistinctPublisher<TResult> |
distinct(ClientSession clientSession,
String fieldName,
Class<TResult> resultClass)
Gets the distinct values of the specified field name.
|
<TResult> DistinctPublisher<TResult> |
distinct(String fieldName,
Bson filter,
Class<TResult> resultClass)
Gets the distinct values of the specified field name.
|
<TResult> DistinctPublisher<TResult> |
distinct(String fieldName,
Class<TResult> resultClass)
Gets the distinct values of the specified field name.
|
org.reactivestreams.Publisher<Success> |
drop()
Drops this collection from the Database.
|
org.reactivestreams.Publisher<Success> |
drop(ClientSession clientSession)
Drops this collection from the Database.
|
org.reactivestreams.Publisher<Success> |
dropIndex(Bson keys)
Drops the index given the keys used to create it.
|
org.reactivestreams.Publisher<Success> |
dropIndex(Bson keys,
DropIndexOptions dropIndexOptions)
Drops the index given the keys used to create it.
|
org.reactivestreams.Publisher<Success> |
dropIndex(ClientSession clientSession,
Bson keys)
Drops the index given the keys used to create it.
|
org.reactivestreams.Publisher<Success> |
dropIndex(ClientSession clientSession,
Bson keys,
DropIndexOptions dropIndexOptions)
Drops the index given the keys used to create it.
|
org.reactivestreams.Publisher<Success> |
dropIndex(ClientSession clientSession,
String indexName)
Drops the given index.
|
org.reactivestreams.Publisher<Success> |
dropIndex(ClientSession clientSession,
String indexName,
DropIndexOptions dropIndexOptions)
Drops the given index.
|
org.reactivestreams.Publisher<Success> |
dropIndex(String indexName)
Drops the given index.
|
org.reactivestreams.Publisher<Success> |
dropIndex(String indexName,
DropIndexOptions dropIndexOptions)
Drops the given index.
|
org.reactivestreams.Publisher<Success> |
dropIndexes()
Drop all the indexes on this collection, except for the default on _id.
|
org.reactivestreams.Publisher<Success> |
dropIndexes(ClientSession clientSession)
Drop all the indexes on this collection, except for the default on _id.
|
org.reactivestreams.Publisher<Success> |
dropIndexes(ClientSession clientSession,
DropIndexOptions dropIndexOptions)
Drop all the indexes on this collection, except for the default on _id.
|
org.reactivestreams.Publisher<Success> |
dropIndexes(DropIndexOptions dropIndexOptions)
Drop all the indexes on this collection, except for the default on _id.
|
org.reactivestreams.Publisher<Long> |
estimatedDocumentCount()
Gets an estimate of the count of documents in a collection using collection metadata.
|
org.reactivestreams.Publisher<Long> |
estimatedDocumentCount(EstimatedDocumentCountOptions options)
Gets an estimate of the count of documents in a collection using collection metadata.
|
FindPublisher<TDocument> |
find()
Finds all documents in the collection.
|
FindPublisher<TDocument> |
find(Bson filter)
Finds all documents in the collection.
|
<TResult> FindPublisher<TResult> |
find(Bson filter,
Class<TResult> clazz)
Finds all documents in the collection.
|
<TResult> FindPublisher<TResult> |
find(Class<TResult> clazz)
Finds all documents in the collection.
|
FindPublisher<TDocument> |
find(ClientSession clientSession)
Finds all documents in the collection.
|
FindPublisher<TDocument> |
find(ClientSession clientSession,
Bson filter)
Finds all documents in the collection.
|
<TResult> FindPublisher<TResult> |
find(ClientSession clientSession,
Bson filter,
Class<TResult> clazz)
Finds all documents in the collection.
|
<TResult> FindPublisher<TResult> |
find(ClientSession clientSession,
Class<TResult> clazz)
Finds all documents in the collection.
|
org.reactivestreams.Publisher<TDocument> |
findOneAndDelete(Bson filter)
Atomically find a document and remove it.
|
org.reactivestreams.Publisher<TDocument> |
findOneAndDelete(Bson filter,
FindOneAndDeleteOptions options)
Atomically find a document and remove it.
|
org.reactivestreams.Publisher<TDocument> |
findOneAndDelete(ClientSession clientSession,
Bson filter)
Atomically find a document and remove it.
|
org.reactivestreams.Publisher<TDocument> |
findOneAndDelete(ClientSession clientSession,
Bson filter,
FindOneAndDeleteOptions options)
Atomically find a document and remove it.
|
org.reactivestreams.Publisher<TDocument> |
findOneAndReplace(Bson filter,
TDocument replacement)
Atomically find a document and replace it.
|
org.reactivestreams.Publisher<TDocument> |
findOneAndReplace(Bson filter,
TDocument replacement,
FindOneAndReplaceOptions options)
Atomically find a document and replace it.
|
org.reactivestreams.Publisher<TDocument> |
findOneAndReplace(ClientSession clientSession,
Bson filter,
TDocument replacement)
Atomically find a document and replace it.
|
org.reactivestreams.Publisher<TDocument> |
findOneAndReplace(ClientSession clientSession,
Bson filter,
TDocument replacement,
FindOneAndReplaceOptions options)
Atomically find a document and replace it.
|
org.reactivestreams.Publisher<TDocument> |
findOneAndUpdate(Bson filter,
Bson update)
Atomically find a document and update it.
|
org.reactivestreams.Publisher<TDocument> |
findOneAndUpdate(Bson filter,
Bson update,
FindOneAndUpdateOptions options)
Atomically find a document and update it.
|
org.reactivestreams.Publisher<TDocument> |
findOneAndUpdate(ClientSession clientSession,
Bson filter,
Bson update)
Atomically find a document and update it.
|
org.reactivestreams.Publisher<TDocument> |
findOneAndUpdate(ClientSession clientSession,
Bson filter,
Bson update,
FindOneAndUpdateOptions options)
Atomically find a document and update it.
|
CodecRegistry |
getCodecRegistry()
Get the codec registry for the MongoCollection.
|
Class<TDocument> |
getDocumentClass()
Get the class of documents stored in this collection.
|
MongoNamespace |
getNamespace()
Gets the namespace of this collection.
|
ReadConcern |
getReadConcern()
Get the read concern for the MongoCollection.
|
ReadPreference |
getReadPreference()
Get the read preference for the MongoCollection.
|
WriteConcern |
getWriteConcern()
Get the write concern for the MongoCollection.
|
org.reactivestreams.Publisher<Success> |
insertMany(ClientSession clientSession,
List<? extends TDocument> documents)
Inserts a batch of documents.
|
org.reactivestreams.Publisher<Success> |
insertMany(ClientSession clientSession,
List<? extends TDocument> documents,
InsertManyOptions options)
Inserts a batch of documents.
|
org.reactivestreams.Publisher<Success> |
insertMany(List<? extends TDocument> documents)
Inserts a batch of documents.
|
org.reactivestreams.Publisher<Success> |
insertMany(List<? extends TDocument> documents,
InsertManyOptions options)
Inserts a batch of documents.
|
org.reactivestreams.Publisher<Success> |
insertOne(ClientSession clientSession,
TDocument document)
Inserts the provided document.
|
org.reactivestreams.Publisher<Success> |
insertOne(ClientSession clientSession,
TDocument document,
InsertOneOptions options)
Inserts the provided document.
|
org.reactivestreams.Publisher<Success> |
insertOne(TDocument document)
Inserts the provided document.
|
org.reactivestreams.Publisher<Success> |
insertOne(TDocument document,
InsertOneOptions options)
Inserts the provided document.
|
ListIndexesPublisher<Document> |
listIndexes()
Get all the indexes in this collection.
|
<TResult> ListIndexesPublisher<TResult> |
listIndexes(Class<TResult> clazz)
Get all the indexes in this collection.
|
ListIndexesPublisher<Document> |
listIndexes(ClientSession clientSession)
Get all the indexes in this collection.
|
<TResult> ListIndexesPublisher<TResult> |
listIndexes(ClientSession clientSession,
Class<TResult> clazz)
Get all the indexes in this collection.
|
MapReducePublisher<Document> |
mapReduce(ClientSession clientSession,
String mapFunction,
String reduceFunction)
Aggregates documents according to the specified map-reduce function.
|
<TResult> MapReducePublisher<TResult> |
mapReduce(ClientSession clientSession,
String mapFunction,
String reduceFunction,
Class<TResult> clazz)
Aggregates documents according to the specified map-reduce function.
|
MapReducePublisher<Document> |
mapReduce(String mapFunction,
String reduceFunction)
Aggregates documents according to the specified map-reduce function.
|
<TResult> MapReducePublisher<TResult> |
mapReduce(String mapFunction,
String reduceFunction,
Class<TResult> clazz)
Aggregates documents according to the specified map-reduce function.
|
org.reactivestreams.Publisher<Success> |
renameCollection(ClientSession clientSession,
MongoNamespace newCollectionNamespace)
Rename the collection with oldCollectionName to the newCollectionName.
|
org.reactivestreams.Publisher<Success> |
renameCollection(ClientSession clientSession,
MongoNamespace newCollectionNamespace,
RenameCollectionOptions options)
Rename the collection with oldCollectionName to the newCollectionName.
|
org.reactivestreams.Publisher<Success> |
renameCollection(MongoNamespace newCollectionNamespace)
Rename the collection with oldCollectionName to the newCollectionName.
|
org.reactivestreams.Publisher<Success> |
renameCollection(MongoNamespace newCollectionNamespace,
RenameCollectionOptions options)
Rename the collection with oldCollectionName to the newCollectionName.
|
org.reactivestreams.Publisher<UpdateResult> |
replaceOne(Bson filter,
TDocument replacement)
Replace a document in the collection according to the specified arguments.
|
org.reactivestreams.Publisher<UpdateResult> |
replaceOne(Bson filter,
TDocument replacement,
ReplaceOptions options)
Replace a document in the collection according to the specified arguments.
|
org.reactivestreams.Publisher<UpdateResult> |
replaceOne(Bson filter,
TDocument replacement,
UpdateOptions options)
Deprecated.
|
org.reactivestreams.Publisher<UpdateResult> |
replaceOne(ClientSession clientSession,
Bson filter,
TDocument replacement)
Replace a document in the collection according to the specified arguments.
|
org.reactivestreams.Publisher<UpdateResult> |
replaceOne(ClientSession clientSession,
Bson filter,
TDocument replacement,
ReplaceOptions options)
Replace a document in the collection according to the specified arguments.
|
org.reactivestreams.Publisher<UpdateResult> |
replaceOne(ClientSession clientSession,
Bson filter,
TDocument replacement,
UpdateOptions options)
Deprecated.
|
org.reactivestreams.Publisher<UpdateResult> |
updateMany(Bson filter,
Bson update)
Update all documents in the collection according to the specified arguments.
|
org.reactivestreams.Publisher<UpdateResult> |
updateMany(Bson filter,
Bson update,
UpdateOptions options)
Update all documents in the collection according to the specified arguments.
|
org.reactivestreams.Publisher<UpdateResult> |
updateMany(ClientSession clientSession,
Bson filter,
Bson update)
Update all documents in the collection according to the specified arguments.
|
org.reactivestreams.Publisher<UpdateResult> |
updateMany(ClientSession clientSession,
Bson filter,
Bson update,
UpdateOptions options)
Update all documents in the collection according to the specified arguments.
|
org.reactivestreams.Publisher<UpdateResult> |
updateOne(Bson filter,
Bson update)
Update a single document in the collection according to the specified arguments.
|
org.reactivestreams.Publisher<UpdateResult> |
updateOne(Bson filter,
Bson update,
UpdateOptions options)
Update a single document in the collection according to the specified arguments.
|
org.reactivestreams.Publisher<UpdateResult> |
updateOne(ClientSession clientSession,
Bson filter,
Bson update)
Update a single document in the collection according to the specified arguments.
|
org.reactivestreams.Publisher<UpdateResult> |
updateOne(ClientSession clientSession,
Bson filter,
Bson update,
UpdateOptions options)
Update a single document in the collection according to the specified arguments.
|
ChangeStreamPublisher<Document> |
watch()
Creates a change stream for this collection.
|
<TResult> ChangeStreamPublisher<TResult> |
watch(Class<TResult> resultClass)
Creates a change stream for this collection.
|
ChangeStreamPublisher<Document> |
watch(ClientSession clientSession)
Creates a change stream for this collection.
|
<TResult> ChangeStreamPublisher<TResult> |
watch(ClientSession clientSession,
Class<TResult> resultClass)
Creates a change stream for this collection.
|
ChangeStreamPublisher<Document> |
watch(ClientSession clientSession,
List<? extends Bson> pipeline)
Creates a change stream for this collection.
|
<TResult> ChangeStreamPublisher<TResult> |
watch(ClientSession clientSession,
List<? extends Bson> pipeline,
Class<TResult> resultClass)
Creates a change stream for this collection.
|
ChangeStreamPublisher<Document> |
watch(List<? extends Bson> pipeline)
Creates a change stream for this collection.
|
<TResult> ChangeStreamPublisher<TResult> |
watch(List<? extends Bson> pipeline,
Class<TResult> resultClass)
Creates a change stream for this collection.
|
MongoCollection<TDocument> |
withCodecRegistry(CodecRegistry codecRegistry)
Create a new MongoCollection instance with a different codec registry.
|
<NewTDocument> |
withDocumentClass(Class<NewTDocument> 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.
|
MongoNamespace getNamespace()
Class<TDocument> getDocumentClass()
CodecRegistry getCodecRegistry()
CodecRegistry
ReadPreference getReadPreference()
ReadPreference
WriteConcern getWriteConcern()
WriteConcern
ReadConcern getReadConcern()
ReadConcern
<NewTDocument> MongoCollection<NewTDocument> withDocumentClass(Class<NewTDocument> clazz)
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.MongoCollection<TDocument> withCodecRegistry(CodecRegistry codecRegistry)
codecRegistry
- the new CodecRegistry
for the collectionMongoCollection<TDocument> withReadPreference(ReadPreference readPreference)
readPreference
- the new ReadPreference
for the collectionMongoCollection<TDocument> withWriteConcern(WriteConcern writeConcern)
writeConcern
- the new WriteConcern
for the collectionMongoCollection<TDocument> withReadConcern(ReadConcern readConcern)
readConcern
- the new ReadConcern
for the collection@Deprecated org.reactivestreams.Publisher<Long> count()
countDocuments()
or estimatedDocumentCount()
instead@Deprecated org.reactivestreams.Publisher<Long> count(Bson filter)
countDocuments(Bson)
insteadfilter
- the query filter@Deprecated org.reactivestreams.Publisher<Long> count(Bson filter, CountOptions options)
countDocuments(Bson, CountOptions)
insteadfilter
- the query filteroptions
- the options describing the count@Deprecated org.reactivestreams.Publisher<Long> count(ClientSession clientSession)
countDocuments(ClientSession)
insteadclientSession
- the client session with which to associate this operation@Deprecated org.reactivestreams.Publisher<Long> count(ClientSession clientSession, Bson filter)
countDocuments(ClientSession, Bson)
insteadclientSession
- the client session with which to associate this operationfilter
- the query filter@Deprecated org.reactivestreams.Publisher<Long> count(ClientSession clientSession, Bson filter, CountOptions options)
countDocuments(ClientSession, Bson, CountOptions)
insteadclientSession
- the client session with which to associate this operationfilter
- the query filteroptions
- the options describing the countorg.reactivestreams.Publisher<Long> estimatedDocumentCount()
org.reactivestreams.Publisher<Long> estimatedDocumentCount(EstimatedDocumentCountOptions options)
options
- the options describing the countorg.reactivestreams.Publisher<Long> countDocuments()
Note: When migrating from count()
to countDocuments()
the following query operators must be replaced:
+-------------+--------------------------------+ | Operator | Replacement | +=============+================================+ | $where | $expr | +-------------+--------------------------------+ | $near | $geoWithin with $center | +-------------+--------------------------------+ | $nearSphere | $geoWithin with $centerSphere | +-------------+--------------------------------+
org.reactivestreams.Publisher<Long> countDocuments(Bson filter)
Note: When migrating from count()
to countDocuments()
the following query operators must be replaced:
+-------------+--------------------------------+ | Operator | Replacement | +=============+================================+ | $where | $expr | +-------------+--------------------------------+ | $near | $geoWithin with $center | +-------------+--------------------------------+ | $nearSphere | $geoWithin with $centerSphere | +-------------+--------------------------------+
filter
- the query filterorg.reactivestreams.Publisher<Long> countDocuments(Bson filter, CountOptions options)
Note: When migrating from count()
to countDocuments()
the following query operators must be replaced:
+-------------+--------------------------------+ | Operator | Replacement | +=============+================================+ | $where | $expr | +-------------+--------------------------------+ | $near | $geoWithin with $center | +-------------+--------------------------------+ | $nearSphere | $geoWithin with $centerSphere | +-------------+--------------------------------+
filter
- the query filteroptions
- the options describing the countorg.reactivestreams.Publisher<Long> countDocuments(ClientSession clientSession)
Note: When migrating from count()
to countDocuments()
the following query operators must be replaced:
+-------------+--------------------------------+ | Operator | Replacement | +=============+================================+ | $where | $expr | +-------------+--------------------------------+ | $near | $geoWithin with $center | +-------------+--------------------------------+ | $nearSphere | $geoWithin with $centerSphere | +-------------+--------------------------------+
clientSession
- the client session with which to associate this operationorg.reactivestreams.Publisher<Long> countDocuments(ClientSession clientSession, Bson filter)
clientSession
- the client session with which to associate this operationfilter
- the query filterorg.reactivestreams.Publisher<Long> countDocuments(ClientSession clientSession, Bson filter, CountOptions options)
Note: When migrating from count()
to countDocuments()
the following query operators must be replaced:
+-------------+--------------------------------+ | Operator | Replacement | +=============+================================+ | $where | $expr | +-------------+--------------------------------+ | $near | $geoWithin with $center | +-------------+--------------------------------+ | $nearSphere | $geoWithin with $centerSphere | +-------------+--------------------------------+
clientSession
- the client session with which to associate this operationfilter
- the query filteroptions
- the options describing the count<TResult> DistinctPublisher<TResult> distinct(String fieldName, Class<TResult> resultClass)
TResult
- the target type of the iterable.fieldName
- the field nameresultClass
- the default class to cast any distinct items into.<TResult> DistinctPublisher<TResult> distinct(String fieldName, Bson filter, Class<TResult> resultClass)
TResult
- the target type of the iterable.fieldName
- the field namefilter
- the query filterresultClass
- the default class to cast any distinct items into.<TResult> DistinctPublisher<TResult> distinct(ClientSession clientSession, String fieldName, Class<TResult> resultClass)
TResult
- the target type of the iterable.clientSession
- the client session with which to associate this operationfieldName
- the field nameresultClass
- the default class to cast any distinct items into.<TResult> DistinctPublisher<TResult> distinct(ClientSession clientSession, String fieldName, Bson filter, Class<TResult> resultClass)
TResult
- the target type of the iterable.clientSession
- the client session with which to associate this operationfieldName
- the field namefilter
- the query filterresultClass
- the default class to cast any distinct items into.FindPublisher<TDocument> find()
<TResult> FindPublisher<TResult> find(Class<TResult> clazz)
TResult
- the target document type of the iterable.clazz
- the class to decode each document intoFindPublisher<TDocument> find(Bson filter)
filter
- the query filter<TResult> FindPublisher<TResult> find(Bson filter, Class<TResult> clazz)
TResult
- the target document type of the iterable.filter
- the query filterclazz
- the class to decode each document intoFindPublisher<TDocument> find(ClientSession clientSession)
<TResult> FindPublisher<TResult> find(ClientSession clientSession, Class<TResult> clazz)
FindPublisher<TDocument> find(ClientSession clientSession, Bson filter)
<TResult> FindPublisher<TResult> find(ClientSession clientSession, Bson filter, Class<TResult> clazz)
TResult
- the target document type of the iterable.clientSession
- the client session with which to associate this operationfilter
- the query filterclazz
- the class to decode each document intoAggregatePublisher<Document> aggregate(List<? extends Bson> pipeline)
pipeline
- the aggregate pipeline<TResult> AggregatePublisher<TResult> aggregate(List<? extends Bson> pipeline, Class<TResult> clazz)
TResult
- the target document type of the iterable.pipeline
- the aggregate pipelineclazz
- the class to decode each document intoAggregatePublisher<Document> aggregate(ClientSession clientSession, List<? extends Bson> pipeline)
clientSession
- the client session with which to associate this operationpipeline
- the aggregate pipeline<TResult> AggregatePublisher<TResult> aggregate(ClientSession clientSession, List<? extends Bson> pipeline, Class<TResult> clazz)
TResult
- the target document type of the iterable.clientSession
- the client session with which to associate this operationpipeline
- the aggregate pipelineclazz
- the class to decode each document intoChangeStreamPublisher<Document> watch()
<TResult> ChangeStreamPublisher<TResult> watch(Class<TResult> resultClass)
TResult
- the target document type of the iterable.resultClass
- the class to decode each document intoChangeStreamPublisher<Document> watch(List<? extends Bson> pipeline)
pipeline
- the aggregation pipeline to apply to the change stream<TResult> ChangeStreamPublisher<TResult> watch(List<? extends Bson> pipeline, Class<TResult> resultClass)
TResult
- the target document type of the iterable.pipeline
- the aggregation pipeline to apply to the change streamresultClass
- the class to decode each document intoChangeStreamPublisher<Document> watch(ClientSession clientSession)
clientSession
- the client session with which to associate this operation<TResult> ChangeStreamPublisher<TResult> watch(ClientSession clientSession, Class<TResult> resultClass)
TResult
- the target document type of the iterable.clientSession
- the client session with which to associate this operationresultClass
- the class to decode each document intoChangeStreamPublisher<Document> watch(ClientSession clientSession, List<? extends Bson> pipeline)
clientSession
- the client session with which to associate this operationpipeline
- the aggregation pipeline to apply to the change stream<TResult> ChangeStreamPublisher<TResult> watch(ClientSession clientSession, List<? extends Bson> pipeline, Class<TResult> resultClass)
TResult
- the target document type of the iterable.clientSession
- the client session with which to associate this operationpipeline
- the aggregation pipeline to apply to the change streamresultClass
- the class to decode each document intoMapReducePublisher<Document> mapReduce(String mapFunction, String reduceFunction)
mapFunction
- A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.reduceFunction
- A JavaScript function that "reduces" to a single object all the values associated with a particular key.<TResult> MapReducePublisher<TResult> mapReduce(String mapFunction, String reduceFunction, Class<TResult> clazz)
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.clazz
- the class to decode each resulting document into.MapReducePublisher<Document> mapReduce(ClientSession clientSession, String mapFunction, String reduceFunction)
clientSession
- the client session with which to associate this operationmapFunction
- A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.reduceFunction
- A JavaScript function that "reduces" to a single object all the values associated with a particular key.<TResult> MapReducePublisher<TResult> mapReduce(ClientSession clientSession, String mapFunction, String reduceFunction, Class<TResult> clazz)
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.clazz
- the class to decode each resulting document into.org.reactivestreams.Publisher<BulkWriteResult> bulkWrite(List<? extends WriteModel<? extends TDocument>> requests)
requests
- the writes to executeorg.reactivestreams.Publisher<BulkWriteResult> bulkWrite(List<? extends WriteModel<? extends TDocument>> requests, BulkWriteOptions options)
requests
- the writes to executeoptions
- the options to apply to the bulk write operationorg.reactivestreams.Publisher<BulkWriteResult> bulkWrite(ClientSession clientSession, List<? extends WriteModel<? extends TDocument>> requests)
clientSession
- the client session with which to associate this operationrequests
- the writes to executeorg.reactivestreams.Publisher<BulkWriteResult> bulkWrite(ClientSession clientSession, List<? extends WriteModel<? extends TDocument>> requests, BulkWriteOptions options)
clientSession
- the client session with which to associate this operationrequests
- the writes to executeoptions
- the options to apply to the bulk write operationorg.reactivestreams.Publisher<Success> insertOne(TDocument document)
document
- the document to insertorg.reactivestreams.Publisher<Success> insertOne(TDocument document, InsertOneOptions options)
document
- the document to insertoptions
- the options to apply to the operationorg.reactivestreams.Publisher<Success> insertOne(ClientSession clientSession, TDocument document)
clientSession
- the client session with which to associate this operationdocument
- the document to insertorg.reactivestreams.Publisher<Success> insertOne(ClientSession clientSession, TDocument document, InsertOneOptions options)
clientSession
- the client session with which to associate this operationdocument
- the document to insertoptions
- the options to apply to the operationorg.reactivestreams.Publisher<Success> insertMany(List<? extends TDocument> documents)
documents
- the documents to insertorg.reactivestreams.Publisher<Success> insertMany(List<? extends TDocument> documents, InsertManyOptions options)
documents
- the documents to insertoptions
- the options to apply to the operationorg.reactivestreams.Publisher<Success> insertMany(ClientSession clientSession, List<? extends TDocument> documents)
clientSession
- the client session with which to associate this operationdocuments
- the documents to insertorg.reactivestreams.Publisher<Success> insertMany(ClientSession clientSession, List<? extends TDocument> documents, InsertManyOptions options)
clientSession
- the client session with which to associate this operationdocuments
- the documents to insertoptions
- the options to apply to the operationorg.reactivestreams.Publisher<DeleteResult> deleteOne(Bson filter)
filter
- the query filter to apply the the delete operationorg.reactivestreams.Publisher<DeleteResult> deleteOne(Bson filter, DeleteOptions options)
filter
- the query filter to apply the the delete operationoptions
- the options to apply to the delete operationorg.reactivestreams.Publisher<DeleteResult> deleteOne(ClientSession clientSession, Bson filter)
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the delete operationorg.reactivestreams.Publisher<DeleteResult> deleteOne(ClientSession clientSession, Bson filter, DeleteOptions options)
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 operationorg.reactivestreams.Publisher<DeleteResult> deleteMany(Bson filter)
filter
- the query filter to apply the the delete operationorg.reactivestreams.Publisher<DeleteResult> deleteMany(Bson filter, DeleteOptions options)
filter
- the query filter to apply the the delete operationoptions
- the options to apply to the delete operationorg.reactivestreams.Publisher<DeleteResult> deleteMany(ClientSession clientSession, Bson filter)
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the delete operationorg.reactivestreams.Publisher<DeleteResult> deleteMany(ClientSession clientSession, Bson filter, DeleteOptions options)
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 operationorg.reactivestreams.Publisher<UpdateResult> replaceOne(Bson filter, TDocument replacement)
filter
- the query filter to apply the the replace operationreplacement
- the replacement documentorg.reactivestreams.Publisher<UpdateResult> replaceOne(Bson filter, TDocument replacement, ReplaceOptions options)
filter
- the query filter to apply the the replace operationreplacement
- the replacement documentoptions
- the options to apply to the replace operation@Deprecated org.reactivestreams.Publisher<UpdateResult> replaceOne(Bson filter, TDocument replacement, UpdateOptions options)
replaceOne(Bson, Object, ReplaceOptions)
filter
- the query filter to apply the the replace operationreplacement
- the replacement documentoptions
- the options to apply to the replace operationorg.reactivestreams.Publisher<UpdateResult> replaceOne(ClientSession clientSession, Bson filter, TDocument replacement)
clientSession
- the client session with which to associate this operationfilter
- the query filter to apply the the replace operationreplacement
- the replacement documentorg.reactivestreams.Publisher<UpdateResult> replaceOne(ClientSession clientSession, Bson filter, TDocument replacement, ReplaceOptions options)
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 operation@Deprecated org.reactivestreams.Publisher<UpdateResult> replaceOne(ClientSession clientSession, Bson filter, TDocument replacement, UpdateOptions options)
replaceOne(ClientSession, Bson, Object, ReplaceOptions)
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 operationorg.reactivestreams.Publisher<UpdateResult> updateOne(Bson filter, Bson update)
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.org.reactivestreams.Publisher<UpdateResult> updateOne(Bson filter, Bson update, UpdateOptions options)
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 operationorg.reactivestreams.Publisher<UpdateResult> updateOne(ClientSession clientSession, Bson filter, Bson update)
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.org.reactivestreams.Publisher<UpdateResult> updateOne(ClientSession clientSession, Bson filter, Bson update, UpdateOptions options)
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 operationorg.reactivestreams.Publisher<UpdateResult> updateMany(Bson filter, Bson update)
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.org.reactivestreams.Publisher<UpdateResult> updateMany(Bson filter, Bson update, UpdateOptions options)
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 operationorg.reactivestreams.Publisher<UpdateResult> updateMany(ClientSession clientSession, Bson filter, Bson update)
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.org.reactivestreams.Publisher<UpdateResult> updateMany(ClientSession clientSession, Bson filter, Bson update, UpdateOptions options)
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 operationorg.reactivestreams.Publisher<TDocument> findOneAndDelete(Bson filter)
filter
- the query filter to find the document withorg.reactivestreams.Publisher<TDocument> findOneAndDelete(Bson filter, FindOneAndDeleteOptions options)
filter
- the query filter to find the document withoptions
- the options to apply to the operationorg.reactivestreams.Publisher<TDocument> findOneAndDelete(ClientSession clientSession, Bson filter)
clientSession
- the client session with which to associate this operationfilter
- the query filter to find the document withorg.reactivestreams.Publisher<TDocument> findOneAndDelete(ClientSession clientSession, Bson filter, FindOneAndDeleteOptions options)
clientSession
- the client session with which to associate this operationfilter
- the query filter to find the document withoptions
- the options to apply to the operationorg.reactivestreams.Publisher<TDocument> findOneAndReplace(Bson filter, TDocument replacement)
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 returnedorg.reactivestreams.Publisher<TDocument> findOneAndReplace(Bson filter, TDocument replacement, FindOneAndReplaceOptions options)
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 returnedorg.reactivestreams.Publisher<TDocument> findOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement)
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 returnedorg.reactivestreams.Publisher<TDocument> findOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement, FindOneAndReplaceOptions options)
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 returnedorg.reactivestreams.Publisher<TDocument> findOneAndUpdate(Bson filter, Bson update)
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.org.reactivestreams.Publisher<TDocument> findOneAndUpdate(Bson filter, Bson update, FindOneAndUpdateOptions options)
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 returnedorg.reactivestreams.Publisher<TDocument> findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update)
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.org.reactivestreams.Publisher<TDocument> findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update, FindOneAndUpdateOptions options)
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 returnedorg.reactivestreams.Publisher<Success> drop()
org.reactivestreams.Publisher<Success> drop(ClientSession clientSession)
clientSession
- the client session with which to associate this operationorg.reactivestreams.Publisher<String> createIndex(Bson key)
key
- an object describing the index key(s), which may not be null.org.reactivestreams.Publisher<String> createIndex(Bson key, IndexOptions options)
key
- an object describing the index key(s), which may not be null.options
- the options for the indexorg.reactivestreams.Publisher<String> createIndex(ClientSession clientSession, Bson key)
clientSession
- the client session with which to associate this operationkey
- an object describing the index key(s), which may not be null.org.reactivestreams.Publisher<String> createIndex(ClientSession clientSession, Bson key, IndexOptions options)
clientSession
- the client session with which to associate this operationkey
- an object describing the index key(s), which may not be null.options
- the options for the indexorg.reactivestreams.Publisher<String> createIndexes(List<IndexModel> indexes)
indexes
- the list of indexesorg.reactivestreams.Publisher<String> createIndexes(List<IndexModel> indexes, CreateIndexOptions createIndexOptions)
indexes
- the list of indexescreateIndexOptions
- options to use when creating indexesorg.reactivestreams.Publisher<String> createIndexes(ClientSession clientSession, List<IndexModel> indexes)
clientSession
- the client session with which to associate this operationindexes
- the list of indexesorg.reactivestreams.Publisher<String> createIndexes(ClientSession clientSession, List<IndexModel> indexes, CreateIndexOptions createIndexOptions)
clientSession
- the client session with which to associate this operationindexes
- the list of indexescreateIndexOptions
- options to use when creating indexesListIndexesPublisher<Document> listIndexes()
<TResult> ListIndexesPublisher<TResult> listIndexes(Class<TResult> clazz)
TResult
- the target document type of the iterable.clazz
- the class to decode each document intoListIndexesPublisher<Document> listIndexes(ClientSession clientSession)
clientSession
- the client session with which to associate this operation<TResult> ListIndexesPublisher<TResult> listIndexes(ClientSession clientSession, Class<TResult> clazz)
TResult
- the target document type of the iterable.clientSession
- the client session with which to associate this operationclazz
- the class to decode each document intoorg.reactivestreams.Publisher<Success> dropIndex(String indexName)
indexName
- the name of the index to removeorg.reactivestreams.Publisher<Success> dropIndex(Bson keys)
keys
- the keys of the index to removeorg.reactivestreams.Publisher<Success> dropIndex(String indexName, DropIndexOptions dropIndexOptions)
indexName
- the name of the index to removedropIndexOptions
- options to use when dropping indexesorg.reactivestreams.Publisher<Success> dropIndex(Bson keys, DropIndexOptions dropIndexOptions)
keys
- the keys of the index to removedropIndexOptions
- options to use when dropping indexesorg.reactivestreams.Publisher<Success> dropIndex(ClientSession clientSession, String indexName)
clientSession
- the client session with which to associate this operationindexName
- the name of the index to removeorg.reactivestreams.Publisher<Success> dropIndex(ClientSession clientSession, Bson keys)
clientSession
- the client session with which to associate this operationkeys
- the keys of the index to removeorg.reactivestreams.Publisher<Success> dropIndex(ClientSession clientSession, String indexName, DropIndexOptions dropIndexOptions)
clientSession
- the client session with which to associate this operationindexName
- the name of the index to removedropIndexOptions
- options to use when dropping indexesorg.reactivestreams.Publisher<Success> dropIndex(ClientSession clientSession, Bson keys, DropIndexOptions dropIndexOptions)
clientSession
- the client session with which to associate this operationkeys
- the keys of the index to removedropIndexOptions
- options to use when dropping indexesorg.reactivestreams.Publisher<Success> dropIndexes()
org.reactivestreams.Publisher<Success> dropIndexes(DropIndexOptions dropIndexOptions)
dropIndexOptions
- options to use when dropping indexesorg.reactivestreams.Publisher<Success> dropIndexes(ClientSession clientSession)
clientSession
- the client session with which to associate this operationorg.reactivestreams.Publisher<Success> dropIndexes(ClientSession clientSession, DropIndexOptions dropIndexOptions)
clientSession
- the client session with which to associate this operationdropIndexOptions
- options to use when dropping indexesorg.reactivestreams.Publisher<Success> renameCollection(MongoNamespace newCollectionNamespace)
newCollectionNamespace
- the namespace the collection will be renamed toorg.reactivestreams.Publisher<Success> renameCollection(MongoNamespace newCollectionNamespace, RenameCollectionOptions options)
newCollectionNamespace
- the name the collection will be renamed tooptions
- the options for renaming a collectionorg.reactivestreams.Publisher<Success> renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace)
clientSession
- the client session with which to associate this operationnewCollectionNamespace
- the namespace the collection will be renamed toorg.reactivestreams.Publisher<Success> renameCollection(ClientSession clientSession, MongoNamespace newCollectionNamespace, RenameCollectionOptions options)
clientSession
- the client session with which to associate this operationnewCollectionNamespace
- the name the collection will be renamed tooptions
- the options for renaming a collection