Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/mongocxx/include/mongocxx/v1/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <mongocxx/v1/uri-fwd.hpp>

#include <bsoncxx/v1/stdx/optional.hpp>
#include <bsoncxx/v1/stdx/string_view.hpp>

#include <mongocxx/v1/change_stream.hpp>
#include <mongocxx/v1/client_session.hpp>
Expand Down Expand Up @@ -134,12 +135,12 @@ class client {
///
/// Access the database with the given name.
///
MONGOCXX_ABI_EXPORT_CDECL(v1::database) database(std::string name);
MONGOCXX_ABI_EXPORT_CDECL(v1::database) database(bsoncxx::v1::stdx::string_view name);

///
/// Equivalent to `this->database(name)`.
///
MONGOCXX_ABI_EXPORT_CDECL(v1::database) operator[](std::string name);
MONGOCXX_ABI_EXPORT_CDECL(v1::database) operator[](bsoncxx::v1::stdx::string_view name);

///
/// Return an unsorted list of all existing databases.
Expand Down
21 changes: 13 additions & 8 deletions src/mongocxx/include/mongocxx/v1/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ class database {
MONGOCXX_ABI_EXPORT_CDECL(v1::collection) create_collection(
bsoncxx::v1::stdx::string_view name,
bsoncxx::v1::document::view opts = {},
bsoncxx::v1::stdx::optional<v1::write_concern> wc = {});
bsoncxx::v1::stdx::optional<v1::write_concern> const& wc = {});

MONGOCXX_ABI_EXPORT_CDECL(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> wc = {});
bsoncxx::v1::stdx::optional<v1::write_concern> const& wc = {});
/// @}
///

Expand All @@ -190,11 +190,11 @@ class database {
/// - [`dropDatabase` (database command) (MongoDB Manual)](https://www.mongodb.com/docs/manual/reference/command/dropDatabase/)
///
/// @{
MONGOCXX_ABI_EXPORT_CDECL(void) drop(bsoncxx::v1::stdx::optional<v1::write_concern> wc = {});
MONGOCXX_ABI_EXPORT_CDECL(void) drop(bsoncxx::v1::stdx::optional<v1::write_concern> const& wc = {});

MONGOCXX_ABI_EXPORT_CDECL(void) drop(
v1::client_session const& session,
bsoncxx::v1::stdx::optional<v1::write_concern> wc = {});
bsoncxx::v1::stdx::optional<v1::write_concern> const& wc = {});
/// @}
///

Expand All @@ -204,7 +204,7 @@ class database {
/// @throws mongocxx::v1::server_error when a server-side error is encountered and a raw server error is available.
/// @throws mongocxx::v1::exception for all other runtime errors.
///
MONGOCXX_ABI_EXPORT_CDECL(bool) has_collection(bsoncxx::v1::stdx::string_view name) const;
MONGOCXX_ABI_EXPORT_CDECL(bool) has_collection(bsoncxx::v1::stdx::string_view name);

///
/// Return an unsorted list of all collections and views in this database.
Expand Down Expand Up @@ -255,7 +255,7 @@ class database {
/// @see
/// - [Default MongoDB Read Concerns/Write Concerns (MongoDB Manual)](https://www.mongodb.com/docs/manual/reference/mongodb-defaults/)
///
MONGOCXX_ABI_EXPORT_CDECL(void) read_concern(v1::read_concern rc);
MONGOCXX_ABI_EXPORT_CDECL(void) read_concern(v1::read_concern const& rc);

///
/// Return the current default "readConcern" to use for operations on this database.
Expand All @@ -270,7 +270,7 @@ class database {
/// @see
/// - [Default MongoDB Read Concerns/Write Concerns (MongoDB Manual)](https://www.mongodb.com/docs/manual/reference/mongodb-defaults/)
///
MONGOCXX_ABI_EXPORT_CDECL(void) read_preference(v1::read_preference rp);
MONGOCXX_ABI_EXPORT_CDECL(void) read_preference(v1::read_preference const& rp);

///
/// Return the current default "readPreference" to use for operations on this database.
Expand All @@ -285,7 +285,7 @@ class database {
/// @see
/// - [Default MongoDB Read Concerns/Write Concerns (MongoDB Manual)](https://www.mongodb.com/docs/manual/reference/mongodb-defaults/)
///
MONGOCXX_ABI_EXPORT_CDECL(void) write_concern(v1::write_concern wc);
MONGOCXX_ABI_EXPORT_CDECL(void) write_concern(v1::write_concern const& wc);

///
/// Return the current default "writeConcern" to use for operations on this database.
Expand Down Expand Up @@ -343,6 +343,11 @@ class database {
watch(v1::client_session const& session, v1::pipeline const& pipeline, v1::change_stream::options const& opts = {});
/// @}
///

class internal;

private:
/* explicit(false) */ database(void* impl);
};

} // namespace v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1874,9 +1874,9 @@ class collection {
friend ::mongocxx::v_noabi::client_encryption;
friend ::mongocxx::v_noabi::database;

collection(database const& database, bsoncxx::v_noabi::string::view_or_value collection_name);
collection(database& database, bsoncxx::v_noabi::string::view_or_value collection_name);

collection(database const& database, void* collection);
collection(database& database, void* collection);

cursor _aggregate(client_session const* session, pipeline const& pipeline, options::aggregate const& options);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#pragma once

#include <mongocxx/v1/database-fwd.hpp>

#include <mongocxx/config/prelude.hpp>

namespace mongocxx {
Expand All @@ -26,7 +28,7 @@ class database;

namespace mongocxx {

using ::mongocxx::v_noabi::database;
using v_noabi::database;

} // namespace mongocxx

Expand All @@ -36,3 +38,6 @@ using ::mongocxx::v_noabi::database;
/// @file
/// Declares @ref mongocxx::v_noabi::database.
///
/// @par Includes
/// - @ref mongocxx/v1/database-fwd.hpp
///
Loading