#include <userver/storages/mongo/collection.hpp>
MongoDB collection handle, the main way to operate with MongoDB.
Usually retrieved from storages::mongo::Pool
Definition at line 34 of file 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.   | |
| const std::string & | GetCollectionName () const | 
| Get collection name.  | |
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 &) | 
| Cursor storages::mongo::Collection::Aggregate | ( | formats::bson::Value | pipeline, | 
| Options &&... | options ) | 
Executes an aggregation pipeline.
| pipeline | an array of aggregation operations | 
Definition at line 300 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 152 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 160 of file collection.hpp.
| WriteResult storages::mongo::Collection::DeleteMany | ( | formats::bson::Document | selector, | 
| Options &&... | options ) | 
Deletes all matching documents.
Definition at line 253 of file collection.hpp.
| WriteResult storages::mongo::Collection::DeleteOne | ( | formats::bson::Document | selector, | 
| Options &&... | options ) | 
Deletes a single matching document.
Definition at line 244 of file collection.hpp.
| void storages::mongo::Collection::Drop | ( | Options &&... | options | ) | 
Drop collection.
Definition at line 279 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 178 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 262 of file collection.hpp.
| WriteResult storages::mongo::Collection::FindAndRemove | ( | formats::bson::Document | query, | 
| Options &&... | options ) | 
Atomically removes a single matching document.
Definition at line 271 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 186 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 206 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 198 of file collection.hpp.
| operations::Bulk storages::mongo::Collection::MakeOrderedBulk | ( | Options &&... | options | ) | 
Efficiently executes multiple operations in order, stops on error.
Definition at line 286 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 293 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 214 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 234 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 224 of file collection.hpp.