#include <mongocxx/v1/database.hpp>
A MongoDB database.
Public Member Functions | |
| database () | |
| Default initialization. | |
| database (database &&other) noexcept | |
| Move constructor. | |
| database (database const &other) | |
| Copy construction. | |
| ~database () | |
| Destroy this object. | |
| v1::collection | collection (bsoncxx::v1::stdx::string_view name) const |
| Access the collection with the given name. | |
| v1::gridfs::bucket | gridfs_bucket (v1::gridfs::bucket::options const &opts={}) const |
| Return a GridFS bucket for this database. | |
| bool | has_collection (bsoncxx::v1::stdx::string_view name) |
| Return true when this database contains a collection with the given name. | |
| bsoncxx::v1::stdx::string_view | name () const |
| Return the name of this database. | |
| operator bool () const | |
| Return true when *this is NOT in an assign-or-destroy-only state. | |
| database & | operator= (database &&other) noexcept |
| Move assignment. | |
| database & | operator= (database const &other) |
| Copy assignment. | |
| v1::collection | operator[] (bsoncxx::v1::stdx::string_view name) const |
| Equivalent to this->collection(name). | |
| v1::read_concern | read_concern () const |
| Return the current default "readConcern" to use for operations on this database. | |
| void | read_concern (v1::read_concern const &rc) |
| Set the default "readConcern" to use for operations on this database. | |
| v1::read_preference | read_preference () const |
| Return the current default "readPreference" to use for operations on this database. | |
| void | read_preference (v1::read_preference const &rp) |
| Set the default "readPreference" to use for operations on this database. | |
| bsoncxx::v1::document::value | run_command (bsoncxx::v1::document::view command, std::uint32_t server_id) |
| Run an arbitrary database command against the requested specific server. | |
| v1::write_concern | write_concern () const |
| Return the current default "writeConcern" to use for operations on this database. | |
| void | write_concern (v1::write_concern const &wc) |
| Set the default "writeConcern" to use for operations on this database. | |
| 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. | |
| bsoncxx::v1::document::value | run_command (bsoncxx::v1::document::view command) |
| Run an arbitrary database command. | |
| bsoncxx::v1::document::value | run_command (v1::client_session const &session, bsoncxx::v1::document::view command) |
| Run an arbitrary database command. | |
| v1::collection | create_collection (bsoncxx::v1::stdx::string_view name, bsoncxx::v1::document::view opts={}, bsoncxx::v1::stdx::optional< v1::write_concern > const &wc={}) |
| Explicitly create a new collection or view in this database. | |
| v1::collection | create_collection (v1::client_session const &session, bsoncxx::v1::stdx::string_view name, bsoncxx::v1::document::view opts={}, bsoncxx::v1::stdx::optional< v1::write_concern > const &wc={}) |
| Explicitly create a new collection or view in this database. | |
| void | drop (bsoncxx::v1::stdx::optional< v1::write_concern > const &wc={}) |
| Drop this database and all associated data files. | |
| void | drop (v1::client_session const &session, bsoncxx::v1::stdx::optional< v1::write_concern > const &wc={}) |
| Drop this database and all associated data files. | |
| v1::cursor | list_collections (bsoncxx::v1::document::view filter={}) |
| Return an unsorted list of all collections and views in this database. | |
| v1::cursor | list_collections (v1::client_session const &session, bsoncxx::v1::document::view filter={}) |
| Return an unsorted list of all collections and views in this database. | |
| std::vector< std::string > | list_collection_names (bsoncxx::v1::document::view filter={}) |
| Return an unsorted list of the names of all the collections and views in this database. | |
| std::vector< std::string > | list_collection_names (v1::client_session const &session, bsoncxx::v1::document::view filter={}) |
| Return an unsorted list of the names of all the collections and views in this database. | |
| v1::change_stream | watch (v1::change_stream::options const &opts={}) |
| Return a change stream subscribed to this database. | |
| v1::change_stream | watch (v1::client_session const &session, v1::change_stream::options const &opts={}) |
| Return a change stream subscribed to this database. | |
| 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. | |
| mongocxx::v1::database::~database | ( | ) |
Destroy this object.
|
noexcept |
Move constructor.
| mongocxx::v1::database::database | ( | database const & | other | ) |
Copy construction.
| mongocxx::v1::database::database | ( | ) |
Default initialization.
| v1::cursor mongocxx::v1::database::aggregate | ( | v1::client_session const & | session, |
| v1::pipeline const & | pipeline, | ||
| v1::aggregate_options const & | opts = {} ) |
Run an aggregation framework pipeline.
| v1::cursor mongocxx::v1::database::aggregate | ( | v1::pipeline const & | pipeline, |
| v1::aggregate_options const & | opts = {} ) |
Run an aggregation framework pipeline.
| v1::collection mongocxx::v1::database::collection | ( | bsoncxx::v1::stdx::string_view | name | ) | const |
Access the collection with the given name.
| v1::collection mongocxx::v1::database::create_collection | ( | bsoncxx::v1::stdx::string_view | name, |
| bsoncxx::v1::document::view | opts = {}, | ||
| bsoncxx::v1::stdx::optional< v1::write_concern > const & | wc = {} ) |
Explicitly create a new collection or view in this database.
| 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::collection mongocxx::v1::database::create_collection | ( | v1::client_session const & | session, |
| bsoncxx::v1::stdx::string_view | name, | ||
| bsoncxx::v1::document::view | opts = {}, | ||
| bsoncxx::v1::stdx::optional< v1::write_concern > const & | wc = {} ) |
Explicitly create a new collection or view in this database.
| 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::database::drop | ( | bsoncxx::v1::stdx::optional< v1::write_concern > const & | wc = {} | ) |
Drop this database and all associated data files.
| 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::database::drop | ( | v1::client_session const & | session, |
| bsoncxx::v1::stdx::optional< v1::write_concern > const & | wc = {} ) |
Drop this database and all associated data files.
| 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::gridfs::bucket mongocxx::v1::database::gridfs_bucket | ( | v1::gridfs::bucket::options const & | opts = {} | ) | const |
Return a GridFS bucket for this database.
| bool mongocxx::v1::database::has_collection | ( | bsoncxx::v1::stdx::string_view | name | ) |
Return true when this database contains a collection with the given name.
| 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::vector< std::string > mongocxx::v1::database::list_collection_names | ( | bsoncxx::v1::document::view | filter = {} | ) |
Return an unsorted list of the names of all the collections and views in this database.
| 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::vector< std::string > mongocxx::v1::database::list_collection_names | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | filter = {} ) |
Return an unsorted list of the names of all the collections and views in this database.
| 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::database::list_collections | ( | bsoncxx::v1::document::view | filter = {} | ) |
Return an unsorted list of all collections and views in this database.
| 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::database::list_collections | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | filter = {} ) |
Return an unsorted list of all collections and views in this database.
| 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::string_view mongocxx::v1::database::name | ( | ) | const |
Return the name of this database.
|
explicit |
Return true when *this is NOT in an assign-or-destroy-only state.
Move assignment.
| v1::collection mongocxx::v1::database::operator[] | ( | bsoncxx::v1::stdx::string_view | name | ) | const |
Equivalent to this->collection(name).
| v1::read_concern mongocxx::v1::database::read_concern | ( | ) | const |
Return the current default "readConcern" to use for operations on this database.
| void mongocxx::v1::database::read_concern | ( | v1::read_concern const & | rc | ) |
Set the default "readConcern" to use for operations on this database.
Overrides the default inherited from the associated client. May be overridden by individual operations.
| v1::read_preference mongocxx::v1::database::read_preference | ( | ) | const |
Return the current default "readPreference" to use for operations on this database.
| void mongocxx::v1::database::read_preference | ( | v1::read_preference const & | rp | ) |
Set the default "readPreference" to use for operations on this database.
Overrides the default inherited from the associated client. May be overridden by individual operations.
| bsoncxx::v1::document::value mongocxx::v1::database::run_command | ( | bsoncxx::v1::document::view | command | ) |
Run an arbitrary database command.
| 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::document::value mongocxx::v1::database::run_command | ( | bsoncxx::v1::document::view | command, |
| std::uint32_t | server_id ) |
Run an arbitrary database command against the requested specific server.
| 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::document::value mongocxx::v1::database::run_command | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | command ) |
Run an arbitrary database command.
| 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::database::watch | ( | v1::change_stream::options const & | opts = {} | ) |
Return a change stream subscribed to this database.
| v1::change_stream mongocxx::v1::database::watch | ( | v1::client_session const & | session, |
| v1::change_stream::options const & | opts = {} ) |
Return a change stream subscribed to this database.
| v1::change_stream mongocxx::v1::database::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::database::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::write_concern mongocxx::v1::database::write_concern | ( | ) | const |
Return the current default "writeConcern" to use for operations on this database.
| void mongocxx::v1::database::write_concern | ( | v1::write_concern const & | wc | ) |
Set the default "writeConcern" to use for operations on this database.
Overrides the default inherited from the associated client. May be overridden by individual operations.