Example usage for Java com.mongodb.client MongoCollection fields, constructors, methods, implement or subclass
The text is from its open source code.
AggregateIterable | aggregate(List extends Bson> pipeline) Aggregates documents according to the specified aggregation pipeline. |
BulkWriteResult | bulkWrite(List extends WriteModel extends TDocument>> requests, BulkWriteOptions options) Executes a mix of inserts, updates, replaces, and deletes. |
BulkWriteResult | bulkWrite(ClientSession clientSession, List extends WriteModel extends TDocument>> requests) Executes a mix of inserts, updates, replaces, and deletes. |
BulkWriteResult | bulkWrite(List extends WriteModel extends TDocument>> requests) 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(ClientSession clientSession) Counts the number of documents in the collection. |
long | count(Bson filter, CountOptions options) Counts the number of documents in the collection according to the given options. |
long | count(ClientSession clientSession, Bson filter) Counts the number of documents in the collection according to the given options. |
long | countDocuments(Bson filter) Counts the number of documents in the collection according to the given options. |
long | countDocuments(ClientSession clientSession) Counts the number of documents in the collection. |
long | countDocuments() Counts the number of documents in the collection. |
String | createIndex(Bson keys) Create an index with the given keys. |
String | createIndex(Bson keys, IndexOptions indexOptions) Create an index with the given keys and options. |
String | createIndex(ClientSession clientSession, Bson keys) Create an index with the given keys. |
DeleteResult | deleteMany(Bson filter) 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. |
DistinctIterable | distinct(String fieldName, Class Gets the distinct values of the specified field name. |
DistinctIterable | distinct(String fieldName, Bson filter, Class Gets the distinct values of the specified field name. |
DistinctIterable | distinct(ClientSession clientSession, String fieldName, Class Gets the distinct values of the specified field name. |
void | drop() Drops this collection from the Database. |
void | dropIndex(String indexName) Drops the index given its name. |
void | dropIndex(Bson keys) Drops the index given the keys used to create it. |
FindIterable | find(Class Finds all documents in the collection. |
FindIterable | find(Bson filter) Finds all documents in the collection. |
FindIterable | find(ClientSession clientSession) Finds all documents in the collection. |
FindIterable | find() Finds all documents in the collection. |
FindIterable | find(Bson filter, Class Finds all documents in the collection. |
FindIterable | find(ClientSession clientSession, Class Finds all documents in the collection. |
FindIterable | find(ClientSession clientSession, Bson filter) Finds all documents in the collection. |
TDocument | findOneAndDelete(Bson filter) 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 | 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(Bson filter, List extends Bson> update, FindOneAndUpdateOptions options) Atomically find a document and update it. |
TDocument | findOneAndUpdate(ClientSession clientSession, Bson filter, List extends Bson> update) Atomically find a document and update it. |
TDocument | findOneAndUpdate(Bson filter, Bson update) Atomically find a document and update it. |
TDocument | findOneAndUpdate(Bson filter, List extends Bson> update) Atomically find a document and update it. |
CodecRegistry | getCodecRegistry() Get the codec registry for the MongoCollection. |
MongoNamespace | getNamespace() Gets the namespace of this collection. |
ReadPreference | getReadPreference() Get the read preference for the MongoCollection. |
void | insertMany(List extends TDocument> documents) Inserts one or more documents. |
void | insertMany(List extends TDocument> documents, InsertManyOptions options) Inserts one or more documents. |
void | insertMany(ClientSession clientSession, List extends TDocument> documents) Inserts one or more documents. |
void | insertOne(TDocument document) Inserts the provided document. |
void | insertOne(TDocument document, InsertOneOptions options) Inserts the provided document. |
void | insertOne(ClientSession clientSession, TDocument document) Inserts the provided document. |
ListIndexesIterable | listIndexes() Get all the indexes in this collection. |
MapReduceIterable | mapReduce(String mapFunction, String reduceFunction) Aggregates documents according to the specified map-reduce function. |
void | renameCollection(MongoNamespace newCollectionNamespace) Rename the collection with oldCollectionName to the newCollectionName. |
UpdateResult | replaceOne(Bson filter, TDocument replacement, UpdateOptions updateOptions) Replace a document in the collection according to the specified arguments. |
UpdateResult | replaceOne(Bson filter, TDocument replacement, ReplaceOptions replaceOptions) 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(Bson filter, TDocument replacement) Replace a document 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(Bson filter, List extends Bson> update, UpdateOptions updateOptions) Update all documents in the collection according to the specified arguments. |
UpdateResult | updateMany(ClientSession clientSession, Bson filter, List extends Bson> update) Update all documents in the collection according to the specified arguments. |
UpdateResult | updateMany(Bson filter, Bson update) Update all documents in the collection according to the specified arguments. |
UpdateResult | updateMany(Bson filter, List extends Bson> update) 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, List extends 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(Bson filter, List extends Bson> update, UpdateOptions updateOptions) Update a single document in the collection according to the specified arguments. |
UpdateResult | updateOne(ClientSession clientSession, Bson filter, List extends Bson> update) Update a single document in the collection according to the specified arguments. |
ChangeStreamIterable | watch() Creates a change stream for this collection. |
MongoCollection | withDocumentClass(Class Create a new MongoCollection instance with a different default class to cast any documents returned from the database into.. |
MongoCollection | withReadConcern(ReadConcern readConcern) Create a new MongoCollection instance with a different read concern. |
MongoCollection | withWriteConcern(WriteConcern writeConcern) Create a new MongoCollection instance with a different write concern. |