#include <mongocxx/v1/collection.hpp>
A MongoDB collection.
Public Types | |
| enum class | errc |
| Errors codes which may be returned by mongocxx::v1::collection. More... | |
Public Member Functions | |
| collection () | |
| Default initialization. | |
| collection (collection &&other) noexcept | |
| Move constructor. | |
| collection (collection const &other) | |
| Copy construction. | |
| ~collection () | |
| Destroy this object. | |
| template<typename Container, bsoncxx::detail::enable_if_t< is_container< Container >::value > * = nullptr> | |
| bsoncxx::v1::stdx::optional< v1::bulk_write::result > | bulk_write (Container const &writes, v1::bulk_write::options const &opts={}) |
| Equivalent to this->bulk_write(writes.begin(), writes.begin(), opts). | |
| template<typename Container, bsoncxx::detail::enable_if_t< is_container< Container >::value > * = nullptr> | |
| bsoncxx::v1::stdx::optional< v1::bulk_write::result > | bulk_write (v1::client_session const &session, Container const &writes, v1::bulk_write::options const &opts={}) |
| Equivalent to this->bulk_write(session, writes.begin(), writes.begin(), opts). | |
| bsoncxx::v1::stdx::optional< std::string > | create_index (bsoncxx::v1::document::value keys, bsoncxx::v1::document::value index_opts={}, v1::indexes::create_one_options const &create_opts={}) |
| Equivalent to this->indexes().create_one(keys, index_opts, create_opts). | |
| bsoncxx::v1::stdx::optional< std::string > | create_index (v1::client_session const &session, bsoncxx::v1::document::value keys, bsoncxx::v1::document::value index_opts={}, v1::indexes::create_one_options const &create_opts={}) |
| Equivalent to this->indexes().create_one(session, keys, index_opts, create_opts). | |
| std::int64_t | estimated_document_count (v1::estimated_document_count_options const &opts={}) |
| Return an estimate of the number of documents in this collection using collection metadata. | |
| v1::indexes | indexes () |
| Manage indexes associated with this collection. | |
| template<typename Container, bsoncxx::detail::enable_if_t< is_container< Container >::value > * = nullptr> | |
| bsoncxx::v1::stdx::optional< v1::insert_many_result > | insert_many (Container const &docs, v1::insert_many_options const &opts={}) |
| Equivalent to this->insert_many(docs.begin(), docs.end(), opts). | |
| template<typename Container, bsoncxx::detail::enable_if_t< is_container< Container >::value > * = nullptr> | |
| bsoncxx::v1::stdx::optional< v1::insert_many_result > | insert_many (v1::client_session const &session, Container const &docs, v1::insert_many_options const &opts={}) |
| Equivalent to this->insert_many(session, docs.begin(), docs.end(), opts). | |
| v1::cursor | list_indexes () |
| Equivalent to this->indexes.list(). | |
| v1::cursor | list_indexes (v1::client_session const &session) |
| Equivalent to this->indexes.list(session). | |
| bsoncxx::v1::stdx::string_view | name () const |
| Return the name of this collection. | |
| operator bool () const | |
| Return true when *this is NOT in an assign-or-destroy-only state. | |
| collection & | operator= (collection &&other) noexcept |
| Move assignment. | |
| collection & | operator= (collection const &other) |
| Copy assignment. | |
| v1::read_concern | read_concern () const |
| Return the current default "readConcern" to use for operations on this collection. | |
| void | read_concern (v1::read_concern const &rc) |
| Set the default "readConcern" to use for operations on this collection. | |
| v1::read_preference | read_preference () const |
| Return the current default "readPreference" to use for operations on this collection. | |
| void | read_preference (v1::read_preference const &rp) |
| Set the default "readPreference" to use for operations on this collection. | |
| v1::search_indexes | search_indexes () |
| Manage Atlas Search Indexes associated with this collection. | |
| v1::write_concern | write_concern () const |
| Return the current default "writeConcern" to use for operations on this collection. | |
| void | write_concern (v1::write_concern const &wc) |
| Set the default "writeConcern" to use for operations on this collection. | |
| v1::cursor | aggregate (v1::pipeline const &pipeline, v1::aggregate_options const &opts={}) |
| Run an aggregation framework pipeline. | |
| v1::cursor | aggregate (v1::client_session const &session, v1::pipeline const &pipeline, v1::aggregate_options const &opts={}) |
| Run an aggregation framework pipeline. | |
| v1::bulk_write | create_bulk_write (v1::bulk_write::options const &opts={}) |
| Create a bulk write operation. | |
| v1::bulk_write | create_bulk_write (v1::client_session const &session, v1::bulk_write::options const &opts={}) |
| Create a bulk write operation. | |
| bsoncxx::v1::stdx::optional< v1::bulk_write::result > | write (v1::bulk_write::single const &write, v1::bulk_write::options const &opts={}) |
| Equivalent to this->bulk_write(...) with a single write operation. | |
| bsoncxx::v1::stdx::optional< v1::bulk_write::result > | write (v1::client_session const &session, v1::bulk_write::single const &write, v1::bulk_write::options const &opts={}) |
| Equivalent to this->bulk_write(...) with a single write operation. | |
| template<typename InputIt, typename Sentinel, bsoncxx::detail::enable_if_t< is_write_iter< InputIt >::value &&is_sentinel_for< Sentinel, InputIt >::value > * = nullptr> | |
| bsoncxx::v1::stdx::optional< v1::bulk_write::result > | bulk_write (InputIt begin, Sentinel end, v1::bulk_write::options const &opts={}) |
| Execute multiple write operations. | |
| template<typename InputIt, typename Sentinel, bsoncxx::detail::enable_if_t< is_write_iter< InputIt >::value &&is_sentinel_for< Sentinel, InputIt >::value > * = nullptr> | |
| bsoncxx::v1::stdx::optional< v1::bulk_write::result > | bulk_write (v1::client_session const &session, InputIt begin, Sentinel end, v1::bulk_write::options const &opts={}) |
| Execute multiple write operations. | |
| std::int64_t | count_documents (bsoncxx::v1::document::view filter, v1::count_options const &opts={}) |
| Return the number of documents in this collection that match the given query filter. | |
| std::int64_t | count_documents (v1::client_session const &session, bsoncxx::v1::document::view filter, v1::count_options const &opts={}) |
| Return the number of documents in this collection that match the given query filter. | |
| bsoncxx::v1::stdx::optional< v1::delete_many_result > | delete_many (bsoncxx::v1::document::view q, v1::delete_many_options const &opts={}) |
| Delete multiple documents in this collection using the given query filter. | |
| bsoncxx::v1::stdx::optional< v1::delete_many_result > | delete_many (v1::client_session const &session, bsoncxx::v1::document::view q, v1::delete_many_options const &opts={}) |
| Delete multiple documents in this collection using the given query filter. | |
| bsoncxx::v1::stdx::optional< v1::delete_one_result > | delete_one (bsoncxx::v1::document::view q, v1::delete_one_options const &opts={}) |
| Delete a single document in this collection using the given query filter. | |
| bsoncxx::v1::stdx::optional< v1::delete_one_result > | delete_one (v1::client_session const &session, bsoncxx::v1::document::view q, v1::delete_one_options const &opts={}) |
| Delete a single document in this collection using the given query filter. | |
| v1::cursor | distinct (bsoncxx::v1::stdx::string_view key, bsoncxx::v1::document::view query, v1::distinct_options const &opts={}) |
| Return the distinct values for the specified field within this collection. | |
| v1::cursor | distinct (v1::client_session const &session, bsoncxx::v1::stdx::string_view key, bsoncxx::v1::document::view query, v1::distinct_options const &opts={}) |
| Return the distinct values for the specified field within this collection. | |
| void | drop (bsoncxx::v1::stdx::optional< v1::write_concern > const &wc={}, bsoncxx::v1::document::view opts={}) |
| Drop this collection. | |
| void | drop (v1::client_session const &session, bsoncxx::v1::stdx::optional< v1::write_concern > const &wc={}, bsoncxx::v1::document::view opts={}) |
| Drop this collection. | |
| v1::cursor | find (bsoncxx::v1::document::view filter, v1::find_options const &opts={}) |
| Find documents in this collection matching the given query filter. | |
| v1::cursor | find (v1::client_session const &session, bsoncxx::v1::document::view filter, v1::find_options const &opts={}) |
| Find documents in this collection matching the given query filter. | |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > | find_one (bsoncxx::v1::document::view filter, v1::find_options const &opts={}) |
| Return the first matching document obtained by this->find(...). | |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > | find_one (v1::client_session const &session, bsoncxx::v1::document::view filter, v1::find_options const &opts={}) |
| Return the first matching document obtained by this->find(...). | |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > | find_one_and_delete (bsoncxx::v1::document::view query, v1::find_one_and_delete_options const &opts={}) |
| Find a single document in this collection and delete it, returning the original document. | |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > | find_one_and_delete (v1::client_session const &session, bsoncxx::v1::document::view query, v1::find_one_and_delete_options const &opts={}) |
| Find a single document in this collection and delete it, returning the original document. | |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > | find_one_and_replace (bsoncxx::v1::document::view query, bsoncxx::v1::document::view replacement, v1::find_one_and_replace_options const &opts={}) |
| Find a single document in this collection and replace it. | |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > | find_one_and_replace (v1::client_session const &session, bsoncxx::v1::document::view query, bsoncxx::v1::document::view replacement, v1::find_one_and_replace_options const &opts={}) |
| Find a single document in this collection and replace it. | |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > | find_one_and_update (bsoncxx::v1::document::view query, bsoncxx::v1::document::view update, v1::find_one_and_update_options const &opts={}) |
| Find a single document in this collection and update it. | |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > | find_one_and_update (bsoncxx::v1::document::view query, v1::pipeline const &update, v1::find_one_and_update_options const &opts={}) |
| Find a single document in this collection and update it. | |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > | find_one_and_update (v1::client_session const &session, bsoncxx::v1::document::view query, bsoncxx::v1::document::view update, v1::find_one_and_update_options const &opts={}) |
| Find a single document in this collection and update it. | |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > | find_one_and_update (v1::client_session const &session, bsoncxx::v1::document::view query, v1::pipeline const &update, v1::find_one_and_update_options const &opts={}) |
| Find a single document in this collection and update it. | |
| bsoncxx::v1::stdx::optional< v1::insert_one_result > | insert_one (bsoncxx::v1::document::view document, v1::insert_one_options const &opts={}) |
| Insert a single document into this collection as a bulk write operation. | |
| bsoncxx::v1::stdx::optional< v1::insert_one_result > | insert_one (v1::client_session const &session, bsoncxx::v1::document::view document, v1::insert_one_options const &opts={}) |
| Insert a single document into this collection as a bulk write operation. | |
| template<typename InputIt, typename Sentinel, bsoncxx::detail::enable_if_t< is_document_iter< InputIt >::value &&is_sentinel_for< Sentinel, InputIt >::value > * = nullptr> | |
| bsoncxx::v1::stdx::optional< v1::insert_many_result > | insert_many (InputIt begin, Sentinel end, v1::insert_many_options const &opts={}) |
| Insert the given documents into this collection as a bulk write operation. | |
| template<typename InputIt, typename Sentinel, bsoncxx::detail::enable_if_t< is_document_iter< InputIt >::value &&is_sentinel_for< Sentinel, InputIt >::value > * = nullptr> | |
| bsoncxx::v1::stdx::optional< v1::insert_many_result > | insert_many (v1::client_session const &session, InputIt begin, Sentinel end, v1::insert_many_options const &opts={}) |
| Insert the given documents into this collection as a bulk write operation. | |
| void | rename (bsoncxx::v1::stdx::string_view new_name, bool drop_target=false, bsoncxx::v1::stdx::optional< v1::write_concern > const &write_concern={}) |
| Change the name of this collection. | |
| void | rename (v1::client_session const &session, bsoncxx::v1::stdx::string_view new_name, bool drop_target=false, bsoncxx::v1::stdx::optional< v1::write_concern > const &write_concern={}) |
| Change the name of this collection. | |
| bsoncxx::v1::stdx::optional< v1::replace_one_result > | replace_one (bsoncxx::v1::document::view filter, bsoncxx::v1::document::value replacement, v1::replace_one_options const &opts={}) |
| Replace a single document in this collection as a bulk write operation. | |
| bsoncxx::v1::stdx::optional< v1::replace_one_result > | replace_one (v1::client_session const &session, bsoncxx::v1::document::view filter, bsoncxx::v1::document::value replacement, v1::replace_one_options const &opts={}) |
| Replace a single document in this collection as a bulk write operation. | |
| bsoncxx::v1::stdx::optional< v1::update_many_result > | update_many (bsoncxx::v1::document::view filter, bsoncxx::v1::document::view update, v1::update_many_options const &opts={}) |
| Update multiple documents in this collection as a bulk write operation. | |
| bsoncxx::v1::stdx::optional< v1::update_many_result > | update_many (bsoncxx::v1::document::view filter, v1::pipeline const &update, update_many_options const &opts={}) |
| Update multiple documents in this collection as a bulk write operation. | |
| bsoncxx::v1::stdx::optional< v1::update_many_result > | update_many (v1::client_session const &session, bsoncxx::v1::document::view filter, bsoncxx::v1::document::view update, v1::update_many_options const &opts={}) |
| Update multiple documents in this collection as a bulk write operation. | |
| bsoncxx::v1::stdx::optional< v1::update_many_result > | update_many (v1::client_session const &session, bsoncxx::v1::document::view filter, v1::pipeline const &update, v1::update_many_options const &opts={}) |
| Update multiple documents in this collection as a bulk write operation. | |
| bsoncxx::v1::stdx::optional< v1::update_one_result > | update_one (bsoncxx::v1::document::view filter, bsoncxx::v1::document::view update, v1::update_one_options const &opts={}) |
| Update a single document in this collection as a bulk write operation. | |
| bsoncxx::v1::stdx::optional< v1::update_one_result > | update_one (bsoncxx::v1::document::view filter, v1::pipeline const &update, update_one_options const &opts={}) |
| Update a single document in this collection as a bulk write operation. | |
| bsoncxx::v1::stdx::optional< v1::update_one_result > | update_one (v1::client_session const &session, bsoncxx::v1::document::view filter, bsoncxx::v1::document::view update, v1::update_one_options const &opts={}) |
| Update a single document in this collection as a bulk write operation. | |
| bsoncxx::v1::stdx::optional< v1::update_one_result > | update_one (v1::client_session const &session, bsoncxx::v1::document::view filter, v1::pipeline const &update, v1::update_one_options const &opts={}) |
| Update a single document in this collection as a bulk write operation. | |
| v1::change_stream | watch (v1::change_stream::options const &opts={}) |
| Return a change stream subscribed to this collection. | |
| v1::change_stream | watch (v1::client_session const &session, v1::change_stream::options const &opts={}) |
| Return a change stream subscribed to this collection. | |
| v1::change_stream | watch (v1::pipeline const &pipeline, v1::change_stream::options const &opts={}) |
| Return a change stream subscribed to this collection with events filtered/modified by pipeline. | |
| v1::change_stream | watch (v1::client_session const &session, v1::pipeline const &pipeline, v1::change_stream::options const &opts={}) |
| Return a change stream subscribed to this collection with events filtered/modified by pipeline. | |
Static Public Member Functions | |
| static std::error_category const & | error_category () |
| The error category for mongocxx::v1::collection::errc. | |
Friends | |
| std::error_code | make_error_code (errc v) |
| Support implicit conversion to std::error_code. | |
|
strong |
Errors codes which may be returned by mongocxx::v1::collection.
| Enumerator | |
|---|---|
| zero | Zero. |
| max_time_u32 | The "maxTimeMS" field must be representable as an std::uint32_t. |
| mongocxx::v1::collection::~collection | ( | ) |
Destroy this object.
|
noexcept |
Move constructor.
| mongocxx::v1::collection::collection | ( | collection const & | other | ) |
Copy construction.
| mongocxx::v1::collection::collection | ( | ) |
Default initialization.
| v1::cursor mongocxx::v1::collection::aggregate | ( | v1::client_session const & | session, |
| v1::pipeline const & | pipeline, | ||
| v1::aggregate_options const & | opts = {} ) |
Run an aggregation framework pipeline.
| v1::cursor mongocxx::v1::collection::aggregate | ( | v1::pipeline const & | pipeline, |
| v1::aggregate_options const & | opts = {} ) |
Run an aggregation framework pipeline.
|
inline |
Equivalent to this->bulk_write(writes.begin(), writes.begin(), opts).
|
inline |
Execute multiple write operations.
Equivalent to:
|
inline |
Equivalent to this->bulk_write(session, writes.begin(), writes.begin(), opts).
|
inline |
Execute multiple write operations.
Equivalent to:
| std::int64_t mongocxx::v1::collection::count_documents | ( | bsoncxx::v1::document::view | filter, |
| v1::count_options const & | opts = {} ) |
Return the number of documents in this collection that match the given query filter.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| std::int64_t mongocxx::v1::collection::count_documents | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | filter, | ||
| v1::count_options const & | opts = {} ) |
Return the number of documents in this collection that match the given query filter.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::bulk_write mongocxx::v1::collection::create_bulk_write | ( | v1::bulk_write::options const & | opts = {} | ) |
Create a bulk write operation.
The bulk write operation must be executed with mongocxx::v1::bulk_write::execute().
| v1::bulk_write mongocxx::v1::collection::create_bulk_write | ( | v1::client_session const & | session, |
| v1::bulk_write::options const & | opts = {} ) |
Create a bulk write operation.
The bulk write operation must be executed with mongocxx::v1::bulk_write::execute().
|
inline |
Equivalent to this->indexes().create_one(keys, index_opts, create_opts).
|
inline |
Equivalent to this->indexes().create_one(session, keys, index_opts, create_opts).
| bsoncxx::v1::stdx::optional< v1::delete_many_result > mongocxx::v1::collection::delete_many | ( | bsoncxx::v1::document::view | q, |
| v1::delete_many_options const & | opts = {} ) |
Delete multiple documents in this collection using the given query filter.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::delete_many_result > mongocxx::v1::collection::delete_many | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | q, | ||
| v1::delete_many_options const & | opts = {} ) |
Delete multiple documents in this collection using the given query filter.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::delete_one_result > mongocxx::v1::collection::delete_one | ( | bsoncxx::v1::document::view | q, |
| v1::delete_one_options const & | opts = {} ) |
Delete a single document in this collection using the given query filter.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::delete_one_result > mongocxx::v1::collection::delete_one | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | q, | ||
| v1::delete_one_options const & | opts = {} ) |
Delete a single document in this collection using the given query filter.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::cursor mongocxx::v1::collection::distinct | ( | bsoncxx::v1::stdx::string_view | key, |
| bsoncxx::v1::document::view | query, | ||
| v1::distinct_options const & | opts = {} ) |
Return the distinct values for the specified field within this collection.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::cursor mongocxx::v1::collection::distinct | ( | v1::client_session const & | session, |
| bsoncxx::v1::stdx::string_view | key, | ||
| bsoncxx::v1::document::view | query, | ||
| v1::distinct_options const & | opts = {} ) |
Return the distinct values for the specified field within this collection.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| void mongocxx::v1::collection::drop | ( | bsoncxx::v1::stdx::optional< v1::write_concern > const & | wc = {}, |
| bsoncxx::v1::document::view | opts = {} ) |
Drop this collection.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| void mongocxx::v1::collection::drop | ( | v1::client_session const & | session, |
| bsoncxx::v1::stdx::optional< v1::write_concern > const & | wc = {}, | ||
| bsoncxx::v1::document::view | opts = {} ) |
Drop this collection.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
|
static |
The error category for mongocxx::v1::collection::errc.
| std::int64_t mongocxx::v1::collection::estimated_document_count | ( | v1::estimated_document_count_options const & | opts = {} | ) |
Return an estimate of the number of documents in this collection using collection metadata.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::cursor mongocxx::v1::collection::find | ( | bsoncxx::v1::document::view | filter, |
| v1::find_options const & | opts = {} ) |
Find documents in this collection matching the given query filter.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::cursor mongocxx::v1::collection::find | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | filter, | ||
| v1::find_options const & | opts = {} ) |
Find documents in this collection matching the given query filter.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > mongocxx::v1::collection::find_one | ( | bsoncxx::v1::document::view | filter, |
| v1::find_options const & | opts = {} ) |
Return the first matching document obtained by this->find(...).
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > mongocxx::v1::collection::find_one | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | filter, | ||
| v1::find_options const & | opts = {} ) |
Return the first matching document obtained by this->find(...).
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > mongocxx::v1::collection::find_one_and_delete | ( | bsoncxx::v1::document::view | query, |
| v1::find_one_and_delete_options const & | opts = {} ) |
Find a single document in this collection and delete it, returning the original document.
| mongocxx::v1::exception | with mongocxx::v1::collection::errc::max_time_u32 if the "maxTimeMS" field is not representable as an std::uint32_t. |
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > mongocxx::v1::collection::find_one_and_delete | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | query, | ||
| v1::find_one_and_delete_options const & | opts = {} ) |
Find a single document in this collection and delete it, returning the original document.
| mongocxx::v1::exception | with mongocxx::v1::collection::errc::max_time_u32 if the "maxTimeMS" field is not representable as an std::uint32_t. |
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > mongocxx::v1::collection::find_one_and_replace | ( | bsoncxx::v1::document::view | query, |
| bsoncxx::v1::document::view | replacement, | ||
| v1::find_one_and_replace_options const & | opts = {} ) |
Find a single document in this collection and replace it.
| mongocxx::v1::exception | with mongocxx::v1::collection::errc::max_time_u32 if the "maxTimeMS" field is not representable as an std::uint32_t. |
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > mongocxx::v1::collection::find_one_and_replace | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | query, | ||
| bsoncxx::v1::document::view | replacement, | ||
| v1::find_one_and_replace_options const & | opts = {} ) |
Find a single document in this collection and replace it.
| mongocxx::v1::exception | with mongocxx::v1::collection::errc::max_time_u32 if the "maxTimeMS" field is not representable as an std::uint32_t. |
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > mongocxx::v1::collection::find_one_and_update | ( | bsoncxx::v1::document::view | query, |
| bsoncxx::v1::document::view | update, | ||
| v1::find_one_and_update_options const & | opts = {} ) |
Find a single document in this collection and update it.
| mongocxx::v1::exception | with mongocxx::v1::collection::errc::max_time_u32 if the "maxTimeMS" field is not representable as an std::uint32_t. |
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > mongocxx::v1::collection::find_one_and_update | ( | bsoncxx::v1::document::view | query, |
| v1::pipeline const & | update, | ||
| v1::find_one_and_update_options const & | opts = {} ) |
Find a single document in this collection and update it.
| mongocxx::v1::exception | with mongocxx::v1::collection::errc::max_time_u32 if the "maxTimeMS" field is not representable as an std::uint32_t. |
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > mongocxx::v1::collection::find_one_and_update | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | query, | ||
| bsoncxx::v1::document::view | update, | ||
| v1::find_one_and_update_options const & | opts = {} ) |
Find a single document in this collection and update it.
| mongocxx::v1::exception | with mongocxx::v1::collection::errc::max_time_u32 if the "maxTimeMS" field is not representable as an std::uint32_t. |
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< bsoncxx::v1::document::value > mongocxx::v1::collection::find_one_and_update | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | query, | ||
| v1::pipeline const & | update, | ||
| v1::find_one_and_update_options const & | opts = {} ) |
Find a single document in this collection and update it.
| mongocxx::v1::exception | with mongocxx::v1::collection::errc::max_time_u32 if the "maxTimeMS" field is not representable as an std::uint32_t. |
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::indexes mongocxx::v1::collection::indexes | ( | ) |
Manage indexes associated with this collection.
|
inline |
Equivalent to this->insert_many(docs.begin(), docs.end(), opts).
|
inline |
Insert the given documents into this collection as a bulk write operation.
If the document(s) do not contain an "_id" field, an "_id" field is generated using bsoncxx::v1::oid.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
|
inline |
Equivalent to this->insert_many(session, docs.begin(), docs.end(), opts).
|
inline |
Insert the given documents into this collection as a bulk write operation.
If the document(s) do not contain an "_id" field, an "_id" field is generated using bsoncxx::v1::oid.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::insert_one_result > mongocxx::v1::collection::insert_one | ( | bsoncxx::v1::document::view | document, |
| v1::insert_one_options const & | opts = {} ) |
Insert a single document into this collection as a bulk write operation.
If the document does not contain an "_id" field, an "_id" field is generated using bsoncxx::v1::oid.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::insert_one_result > mongocxx::v1::collection::insert_one | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | document, | ||
| v1::insert_one_options const & | opts = {} ) |
Insert a single document into this collection as a bulk write operation.
If the document does not contain an "_id" field, an "_id" field is generated using bsoncxx::v1::oid.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
|
inline |
Equivalent to this->indexes.list().
|
inline |
Equivalent to this->indexes.list(session).
| bsoncxx::v1::stdx::string_view mongocxx::v1::collection::name | ( | ) | const |
Return the name of this collection.
|
explicit |
Return true when *this is NOT in an assign-or-destroy-only state.
|
noexcept |
Move assignment.
| collection & mongocxx::v1::collection::operator= | ( | collection const & | other | ) |
Copy assignment.
| v1::read_concern mongocxx::v1::collection::read_concern | ( | ) | const |
Return the current default "readConcern" to use for operations on this collection.
| void mongocxx::v1::collection::read_concern | ( | v1::read_concern const & | rc | ) |
Set the default "readConcern" to use for operations on this collection.
Overrides the default inherited from the associated database or client. May be overridden by individual operations.
| v1::read_preference mongocxx::v1::collection::read_preference | ( | ) | const |
Return the current default "readPreference" to use for operations on this collection.
| void mongocxx::v1::collection::read_preference | ( | v1::read_preference const & | rp | ) |
Set the default "readPreference" to use for operations on this collection.
Overrides the default inherited from the associated database or client. May be overridden by individual operations.
| void mongocxx::v1::collection::rename | ( | bsoncxx::v1::stdx::string_view | new_name, |
| bool | drop_target = false, | ||
| bsoncxx::v1::stdx::optional< v1::write_concern > const & | write_concern = {} ) |
Change the name of this collection.
| mongocxx::v1::exception | when a client-side or server-side error is encountered. (mongoc does not return the raw server response for this command.) |
| void mongocxx::v1::collection::rename | ( | v1::client_session const & | session, |
| bsoncxx::v1::stdx::string_view | new_name, | ||
| bool | drop_target = false, | ||
| bsoncxx::v1::stdx::optional< v1::write_concern > const & | write_concern = {} ) |
Change the name of this collection.
| mongocxx::v1::exception | when a client-side or server-side error is encountered. (mongoc does not return the raw server response for this command.) |
| bsoncxx::v1::stdx::optional< v1::replace_one_result > mongocxx::v1::collection::replace_one | ( | bsoncxx::v1::document::view | filter, |
| bsoncxx::v1::document::value | replacement, | ||
| v1::replace_one_options const & | opts = {} ) |
Replace a single document in this collection as a bulk write operation.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::replace_one_result > mongocxx::v1::collection::replace_one | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | filter, | ||
| bsoncxx::v1::document::value | replacement, | ||
| v1::replace_one_options const & | opts = {} ) |
Replace a single document in this collection as a bulk write operation.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::search_indexes mongocxx::v1::collection::search_indexes | ( | ) |
Manage Atlas Search Indexes associated with this collection.
| bsoncxx::v1::stdx::optional< v1::update_many_result > mongocxx::v1::collection::update_many | ( | bsoncxx::v1::document::view | filter, |
| bsoncxx::v1::document::view | update, | ||
| v1::update_many_options const & | opts = {} ) |
Update multiple documents in this collection as a bulk write operation.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::update_many_result > mongocxx::v1::collection::update_many | ( | bsoncxx::v1::document::view | filter, |
| v1::pipeline const & | update, | ||
| update_many_options const & | opts = {} ) |
Update multiple documents in this collection as a bulk write operation.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::update_many_result > mongocxx::v1::collection::update_many | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | filter, | ||
| bsoncxx::v1::document::view | update, | ||
| v1::update_many_options const & | opts = {} ) |
Update multiple documents in this collection as a bulk write operation.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::update_many_result > mongocxx::v1::collection::update_many | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | filter, | ||
| v1::pipeline const & | update, | ||
| v1::update_many_options const & | opts = {} ) |
Update multiple documents in this collection as a bulk write operation.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::update_one_result > mongocxx::v1::collection::update_one | ( | bsoncxx::v1::document::view | filter, |
| bsoncxx::v1::document::view | update, | ||
| v1::update_one_options const & | opts = {} ) |
Update a single document in this collection as a bulk write operation.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::update_one_result > mongocxx::v1::collection::update_one | ( | bsoncxx::v1::document::view | filter, |
| v1::pipeline const & | update, | ||
| update_one_options const & | opts = {} ) |
Update a single document in this collection as a bulk write operation.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::update_one_result > mongocxx::v1::collection::update_one | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | filter, | ||
| bsoncxx::v1::document::view | update, | ||
| v1::update_one_options const & | opts = {} ) |
Update a single document in this collection as a bulk write operation.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| bsoncxx::v1::stdx::optional< v1::update_one_result > mongocxx::v1::collection::update_one | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | filter, | ||
| v1::pipeline const & | update, | ||
| v1::update_one_options const & | opts = {} ) |
Update a single document in this collection as a bulk write operation.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::change_stream mongocxx::v1::collection::watch | ( | v1::change_stream::options const & | opts = {} | ) |
Return a change stream subscribed to this collection.
| v1::change_stream mongocxx::v1::collection::watch | ( | v1::client_session const & | session, |
| v1::change_stream::options const & | opts = {} ) |
Return a change stream subscribed to this collection.
| v1::change_stream mongocxx::v1::collection::watch | ( | v1::client_session const & | session, |
| v1::pipeline const & | pipeline, | ||
| v1::change_stream::options const & | opts = {} ) |
Return a change stream subscribed to this collection with events filtered/modified by pipeline.
| v1::change_stream mongocxx::v1::collection::watch | ( | v1::pipeline const & | pipeline, |
| v1::change_stream::options const & | opts = {} ) |
Return a change stream subscribed to this collection with events filtered/modified by pipeline.
|
inline |
Equivalent to this->bulk_write(...) with a single write operation.
|
inline |
Equivalent to this->bulk_write(...) with a single write operation.
| v1::write_concern mongocxx::v1::collection::write_concern | ( | ) | const |
Return the current default "writeConcern" to use for operations on this collection.
| void mongocxx::v1::collection::write_concern | ( | v1::write_concern const & | wc | ) |
Set the default "writeConcern" to use for operations on this collection.
Overrides the default inherited from the associated database or client. May be overridden by individual operations.
|
friend |
Support implicit conversion to std::error_code.