Java com.mongodb.client MongoCollection fields, constructors, methods, implement or subclass

Example usage for Java com.mongodb.client MongoCollection fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for com.mongodb.client MongoCollection.

The text is from its open source code.

Method

AggregateIterableaggregate(List pipeline)
Aggregates documents according to the specified aggregation pipeline.
BulkWriteResultbulkWrite(List> requests, BulkWriteOptions options)
Executes a mix of inserts, updates, replaces, and deletes.
BulkWriteResultbulkWrite(ClientSession clientSession, List> requests)
Executes a mix of inserts, updates, replaces, and deletes.
BulkWriteResultbulkWrite(List> requests)
Executes a mix of inserts, updates, replaces, and deletes.
longcount()
Counts the number of documents in the collection.
longcount(Bson filter)
Counts the number of documents in the collection according to the given options.
longcount(ClientSession clientSession)
Counts the number of documents in the collection.
longcount(Bson filter, CountOptions options)
Counts the number of documents in the collection according to the given options.
longcount(ClientSession clientSession, Bson filter)
Counts the number of documents in the collection according to the given options.
longcountDocuments(Bson filter)
Counts the number of documents in the collection according to the given options.
longcountDocuments(ClientSession clientSession)
Counts the number of documents in the collection.
longcountDocuments()
Counts the number of documents in the collection.
StringcreateIndex(Bson keys)
Create an index with the given keys.
StringcreateIndex(Bson keys, IndexOptions indexOptions)
Create an index with the given keys and options.
StringcreateIndex(ClientSession clientSession, Bson keys)
Create an index with the given keys.
DeleteResultdeleteMany(Bson filter)
Removes all documents from the collection that match the given query filter.
DeleteResultdeleteOne(Bson filter)
Removes at most one document from the collection that matches the given filter.
DistinctIterabledistinct(String fieldName, Class resultClass)
Gets the distinct values of the specified field name.
DistinctIterabledistinct(String fieldName, Bson filter, Class resultClass)
Gets the distinct values of the specified field name.
DistinctIterabledistinct(ClientSession clientSession, String fieldName, Class resultClass)
Gets the distinct values of the specified field name.
voiddrop()
Drops this collection from the Database.
voiddropIndex(String indexName)
Drops the index given its name.
voiddropIndex(Bson keys)
Drops the index given the keys used to create it.
FindIterablefind(Class resultClass)
Finds all documents in the collection.
FindIterablefind(Bson filter)
Finds all documents in the collection.
FindIterablefind(ClientSession clientSession)
Finds all documents in the collection.
FindIterablefind()
Finds all documents in the collection.
FindIterablefind(Bson filter, Class resultClass)
Finds all documents in the collection.
FindIterablefind(ClientSession clientSession, Class resultClass)
Finds all documents in the collection.
FindIterablefind(ClientSession clientSession, Bson filter)
Finds all documents in the collection.
TDocumentfindOneAndDelete(Bson filter)
Atomically find a document and remove it.
TDocumentfindOneAndReplace(Bson filter, TDocument replacement)
Atomically find a document and replace it.
TDocumentfindOneAndReplace(Bson filter, TDocument replacement, FindOneAndReplaceOptions options)
Atomically find a document and replace it.
TDocumentfindOneAndReplace(ClientSession clientSession, Bson filter, TDocument replacement)
Atomically find a document and replace it.
TDocumentfindOneAndUpdate(Bson filter, Bson update, FindOneAndUpdateOptions options)
Atomically find a document and update it.
TDocumentfindOneAndUpdate(ClientSession clientSession, Bson filter, Bson update)
Atomically find a document and update it.
TDocumentfindOneAndUpdate(Bson filter, List update, FindOneAndUpdateOptions options)
Atomically find a document and update it.
TDocumentfindOneAndUpdate(ClientSession clientSession, Bson filter, List update)
Atomically find a document and update it.
TDocumentfindOneAndUpdate(Bson filter, Bson update)
Atomically find a document and update it.
TDocumentfindOneAndUpdate(Bson filter, List update)
Atomically find a document and update it.
CodecRegistrygetCodecRegistry()
Get the codec registry for the MongoCollection.
MongoNamespacegetNamespace()
Gets the namespace of this collection.
ReadPreferencegetReadPreference()
Get the read preference for the MongoCollection.
voidinsertMany(List documents)
Inserts one or more documents.
voidinsertMany(List documents, InsertManyOptions options)
Inserts one or more documents.
voidinsertMany(ClientSession clientSession, List documents)
Inserts one or more documents.
voidinsertOne(TDocument document)
Inserts the provided document.
voidinsertOne(TDocument document, InsertOneOptions options)
Inserts the provided document.
voidinsertOne(ClientSession clientSession, TDocument document)
Inserts the provided document.
ListIndexesIterablelistIndexes()
Get all the indexes in this collection.
MapReduceIterablemapReduce(String mapFunction, String reduceFunction)
Aggregates documents according to the specified map-reduce function.
voidrenameCollection(MongoNamespace newCollectionNamespace)
Rename the collection with oldCollectionName to the newCollectionName.
UpdateResultreplaceOne(Bson filter, TDocument replacement, UpdateOptions updateOptions)
Replace a document in the collection according to the specified arguments.
UpdateResultreplaceOne(Bson filter, TDocument replacement, ReplaceOptions replaceOptions)
Replace a document in the collection according to the specified arguments.
UpdateResultreplaceOne(ClientSession clientSession, Bson filter, TDocument replacement)
Replace a document in the collection according to the specified arguments.
UpdateResultreplaceOne(Bson filter, TDocument replacement)
Replace a document in the collection according to the specified arguments.
UpdateResultupdateMany(Bson filter, Bson update, UpdateOptions updateOptions)
Update all documents in the collection according to the specified arguments.
UpdateResultupdateMany(ClientSession clientSession, Bson filter, Bson update)
Update all documents in the collection according to the specified arguments.
UpdateResultupdateMany(Bson filter, List update, UpdateOptions updateOptions)
Update all documents in the collection according to the specified arguments.
UpdateResultupdateMany(ClientSession clientSession, Bson filter, List update)
Update all documents in the collection according to the specified arguments.
UpdateResultupdateMany(Bson filter, Bson update)
Update all documents in the collection according to the specified arguments.
UpdateResultupdateMany(Bson filter, List update)
Update all documents in the collection according to the specified arguments.
UpdateResultupdateOne(Bson filter, Bson update)
Update a single document in the collection according to the specified arguments.
UpdateResultupdateOne(Bson filter, List update)
Update a single document in the collection according to the specified arguments.
UpdateResultupdateOne(Bson filter, Bson update, UpdateOptions updateOptions)
Update a single document in the collection according to the specified arguments.
UpdateResultupdateOne(ClientSession clientSession, Bson filter, Bson update)
Update a single document in the collection according to the specified arguments.
UpdateResultupdateOne(Bson filter, List update, UpdateOptions updateOptions)
Update a single document in the collection according to the specified arguments.
UpdateResultupdateOne(ClientSession clientSession, Bson filter, List update)
Update a single document in the collection according to the specified arguments.
ChangeStreamIterablewatch()
Creates a change stream for this collection.
MongoCollectionwithDocumentClass(Class clazz)
Create a new MongoCollection instance with a different default class to cast any documents returned from the database into..
MongoCollectionwithReadConcern(ReadConcern readConcern)
Create a new MongoCollection instance with a different read concern.
MongoCollectionwithWriteConcern(WriteConcern writeConcern)
Create a new MongoCollection instance with a different write concern.