MongoDB collection handle, the main way to operate with MongoDB. More...
#include <userver/storages/mongo/collection.hpp>
Public Member Functions | |
| template<typename... Options> | |
| size_t | Count (formats::bson::Document filter, Options &&... options) const |
| Returns the number of documents matching the query. | |
| template<typename... Options> | |
| size_t | CountApprox (Options &&... options) const |
| Returns an approximated count of all documents in the collection. | |
| template<typename... Options> | |
| Cursor | Find (formats::bson::Document filter, Options &&... options) const |
| Performs a query on the collection. | |
| template<typename... Options> | |
| std::optional< formats::bson::Document > | FindOne (formats::bson::Document filter, Options &&... options) const |
| Retrieves a single document from the collection. | |
| template<typename... Options> | |
| WriteResult | InsertOne (formats::bson::Document document, Options &&... options) |
| Inserts a single document into the collection. | |
| template<typename... Options> | |
| WriteResult | InsertMany (std::vector< formats::bson::Document > documents, Options &&... options) |
| Inserts multiple documents into the collection. | |
| template<typename... Options> | |
| WriteResult | ReplaceOne (formats::bson::Document selector, formats::bson::Document replacement, Options &&... options) |
| Replaces a single matching document. | |
| template<typename... Options> | |
| WriteResult | UpdateOne (formats::bson::Document selector, formats::bson::Document update, Options &&... options) |
| Updates a single matching document. | |
| template<typename... Options> | |
| WriteResult | UpdateMany (formats::bson::Document selector, formats::bson::Document update, Options &&... options) |
| Updates all matching documents. | |
| template<typename... Options> | |
| WriteResult | DeleteOne (formats::bson::Document selector, Options &&... options) |
| Deletes a single matching document. | |
| template<typename... Options> | |
| WriteResult | DeleteMany (formats::bson::Document selector, Options &&... options) |
| Deletes all matching documents. | |
| template<typename... Options> | |
| WriteResult | FindAndModify (formats::bson::Document query, const formats::bson::Document &update, Options &&... options) |
| Atomically updates a single matching document. | |
| template<typename... Options> | |
| WriteResult | FindAndRemove (formats::bson::Document query, Options &&... options) |
| Atomically removes a single matching document. | |
| template<typename... Options> | |
| void | Drop (Options &&... options) |
| Drop collection. | |
| template<typename... Options> | |
| operations::Bulk | MakeOrderedBulk (Options &&... options) |
| Efficiently executes multiple operations in order, stops on error. | |
| template<typename... Options> | |
| operations::Bulk | MakeUnorderedBulk (Options &&... options) |
| Efficiently executes multiple operations out of order, continues on error. | |
| template<typename... Options> | |
| Cursor | Aggregate (formats::bson::Value pipeline, Options &&... options) |
| Executes an aggregation pipeline. | |
Prepared operation executors | |
| size_t | Execute (const operations::Count &) const |
| size_t | Execute (const operations::CountApprox &) const |
| Cursor | Execute (const operations::Find &) const |
| WriteResult | Execute (const operations::InsertOne &) |
| WriteResult | Execute (const operations::InsertMany &) |
| WriteResult | Execute (const operations::ReplaceOne &) |
| WriteResult | Execute (const operations::Update &) |
| WriteResult | Execute (const operations::Delete &) |
| WriteResult | Execute (const operations::FindAndModify &) |
| WriteResult | Execute (const operations::FindAndRemove &) |
| WriteResult | Execute (operations::Bulk &&) |
| Cursor | Execute (const operations::Aggregate &) |
| void | Execute (const operations::Drop &) |
MongoDB collection handle, the main way to operate with MongoDB.
Usually retrieved from storages::mongo::Pool
Definition at line 33 of file collection.hpp.
| Cursor storages::mongo::Collection::Aggregate | ( | formats::bson::Value | pipeline, |
| Options &&... | options | ||
| ) |
Executes an aggregation pipeline.
| pipeline | an array of aggregation operations |
Definition at line 296 of file collection.hpp.
| size_t storages::mongo::Collection::Count | ( | formats::bson::Document | filter, |
| Options &&... | options | ||
| ) | const |
Returns the number of documents matching the query.
Definition at line 148 of file collection.hpp.
| size_t storages::mongo::Collection::CountApprox | ( | Options &&... | options | ) | const |
Returns an approximated count of all documents in the collection.
Definition at line 156 of file collection.hpp.
| WriteResult storages::mongo::Collection::DeleteMany | ( | formats::bson::Document | selector, |
| Options &&... | options | ||
| ) |
Deletes all matching documents.
Definition at line 249 of file collection.hpp.
| WriteResult storages::mongo::Collection::DeleteOne | ( | formats::bson::Document | selector, |
| Options &&... | options | ||
| ) |
Deletes a single matching document.
Definition at line 240 of file collection.hpp.
| void storages::mongo::Collection::Drop | ( | Options &&... | options | ) |
Drop collection.
Definition at line 275 of file collection.hpp.
| Cursor storages::mongo::Collection::Find | ( | formats::bson::Document | filter, |
| Options &&... | options | ||
| ) | const |
Performs a query on the collection.
Definition at line 174 of file collection.hpp.
| WriteResult storages::mongo::Collection::FindAndModify | ( | formats::bson::Document | query, |
| const formats::bson::Document & | update, | ||
| Options &&... | options | ||
| ) |
Atomically updates a single matching document.
Definition at line 258 of file collection.hpp.
| WriteResult storages::mongo::Collection::FindAndRemove | ( | formats::bson::Document | query, |
| Options &&... | options | ||
| ) |
Atomically removes a single matching document.
Definition at line 267 of file collection.hpp.
| std::optional< formats::bson::Document > storages::mongo::Collection::FindOne | ( | formats::bson::Document | filter, |
| Options &&... | options | ||
| ) | const |
Retrieves a single document from the collection.
Definition at line 182 of file collection.hpp.
| WriteResult storages::mongo::Collection::InsertMany | ( | std::vector< formats::bson::Document > | documents, |
| Options &&... | options | ||
| ) |
Inserts multiple documents into the collection.
Definition at line 202 of file collection.hpp.
| WriteResult storages::mongo::Collection::InsertOne | ( | formats::bson::Document | document, |
| Options &&... | options | ||
| ) |
Inserts a single document into the collection.
Definition at line 194 of file collection.hpp.
| operations::Bulk storages::mongo::Collection::MakeOrderedBulk | ( | Options &&... | options | ) |
Efficiently executes multiple operations in order, stops on error.
Definition at line 282 of file collection.hpp.
| operations::Bulk storages::mongo::Collection::MakeUnorderedBulk | ( | Options &&... | options | ) |
Efficiently executes multiple operations out of order, continues on error.
Definition at line 289 of file collection.hpp.
| WriteResult storages::mongo::Collection::ReplaceOne | ( | formats::bson::Document | selector, |
| formats::bson::Document | replacement, | ||
| Options &&... | options | ||
| ) |
Replaces a single matching document.
Definition at line 210 of file collection.hpp.
| WriteResult storages::mongo::Collection::UpdateMany | ( | formats::bson::Document | selector, |
| formats::bson::Document | update, | ||
| Options &&... | options | ||
| ) |
Updates all matching documents.
Definition at line 230 of file collection.hpp.
| WriteResult storages::mongo::Collection::UpdateOne | ( | formats::bson::Document | selector, |
| formats::bson::Document | update, | ||
| Options &&... | options | ||
| ) |
Updates a single matching document.
Definition at line 220 of file collection.hpp.