25#include <initializer_list>
114 class _empty_doc_tag {};
164 return std::move(_coll);
338 template <
typename container_type>
340 container_type
const& writes,
369 template <
typename container_type>
372 container_type
const& writes,
400 template <
typename write_model_iterator_type>
402 write_model_iterator_type begin,
403 write_model_iterator_type end,
406 std::for_each(begin, end, [&](
model::write const& current) { writes.append(current); });
407 return writes.execute();
435 template <
typename write_model_iterator_type>
438 write_model_iterator_type begin,
439 write_model_iterator_type end,
442 std::for_each(begin, end, [&](
model::write const& current) { writes.append(current); });
443 return writes.execute();
544 auto const name_opt = this->
indexes().
create_one(keys, index_options, operation_options);
577 auto const name_opt = this->
indexes().
create_one(session, keys, index_options, operation_options);
1036 std::initializer_list<_empty_doc_tag> update,
1123 std::initializer_list<_empty_doc_tag> update,
1191 template <
typename container_type>
1193 container_type
const& container,
1219 template <
typename container_type>
1222 container_type
const& container,
1250 template <
typename document_view_iterator_type>
1252 document_view_iterator_type begin,
1253 document_view_iterator_type end,
1255 return this->_insert_many(
nullptr, begin, end,
options);
1279 template <
typename document_view_iterator_type>
1282 document_view_iterator_type begin,
1283 document_view_iterator_type end,
1285 return this->_insert_many(&session, begin, end,
options);
1346 bool drop_target_before_rename = false,
1374 bool drop_target_before_rename = false,
1556 std::initializer_list<_empty_doc_tag> update,
1646 std::initializer_list<_empty_doc_tag> update,
1727 std::initializer_list<_empty_doc_tag> update,
1817 std::initializer_list<_empty_doc_tag> update,
1926 _insert_many_doc_handler(
1934 template <
typename document_view_iterator_type>
1937 document_view_iterator_type begin,
1938 document_view_iterator_type end,
1941 auto writes = _init_insert_many(
options, session);
1943 _insert_many_doc_handler(writes, inserted_ids, doc);
1945 return _exec_insert_many(writes, inserted_ids);
1959 return {std::move(v)};
Provides mongocxx::v_noabi::options::aggregate.
Provides bsoncxx::v_noabi::builder::basic::array.
Provides bsoncxx::v_noabi::builder::basic::document.
A polyfill for std::optional<T>.
Definition optional.hpp:799
A polyfill for std::string_view.
Definition string_view.hpp:412
A traditional builder-style interface for constructing a BSON array.
Definition array.hpp:37
A traditional builder-style interface for constructing a BSON document.
Definition document.hpp:41
A read-only BSON document that owns its underlying buffer.
Definition value.hpp:48
A read-only, non-owning view of a BSON document.
Definition view.hpp:40
A view-or-value variant type.
Definition view_or_value.hpp:32
collection() noexcept
Default constructs a collection object. The collection is equivalent to the state of a moved from col...
Definition collection.hpp:123
A MongoDB collection.
Definition collection.hpp:83
A batch of write operations that can be sent to the server as a group.
Definition bulk_write.hpp:54
bsoncxx::v_noabi::stdx::optional< result::bulk_write > execute() const
Executes a bulk write.
bulk_write & append(v_noabi::model::write const &operation)
Appends a single write to the bulk write operation. The write operation's contents are copied into th...
A MongoDB change stream.
Definition change_stream.hpp:44
Supports MongoDB client session operations.
Definition client_session.hpp:58
A MongoDB collection.
Definition collection.hpp:98
bsoncxx::v_noabi::stdx::optional< v_noabi::result::bulk_write > bulk_write(write_model_iterator_type begin, write_model_iterator_type end, v_noabi::options::bulk_write const &options={})
Sends writes starting at begin and ending at end to the server as a bulk write operation.
Definition collection.hpp:401
bsoncxx::v_noabi::stdx::optional< v_noabi::result::insert_many > insert_many(v_noabi::client_session const &session, container_type const &container, v_noabi::options::insert const &options={})
Inserts multiple documents into the collection. If any of the documents are missing identifiers the d...
Definition collection.hpp:1220
void read_concern(v_noabi::read_concern rc)
Sets the read_concern for this collection. Changes will not have any effect on existing cursors or ot...
bsoncxx::v_noabi::stdx::optional< v_noabi::result::bulk_write > bulk_write(v_noabi::client_session const &session, write_model_iterator_type begin, write_model_iterator_type end, v_noabi::options::bulk_write const &options={})
Sends writes starting at begin and ending at end to the server as a bulk write operation.
Definition collection.hpp:436
bsoncxx::v_noabi::stdx::optional< v_noabi::result::replace_one > replace_one(bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value replacement, v_noabi::options::replace const &options={})
Replaces a single document matching the provided filter in this collection.
void write_concern(v_noabi::write_concern wc)
Sets the write_concern for this collection. Changes will not have any effect on existing write operat...
bsoncxx::v_noabi::document::value create_index(bsoncxx::v_noabi::document::view_or_value keys, bsoncxx::v_noabi::document::view_or_value index_options={}, v_noabi::options::index_view operation_options={})
Creates an index over the collection for the provided keys with the provided options.
Definition collection.hpp:538
v_noabi::cursor list_indexes() const
Returns a list of the indexes currently on this collection.
bsoncxx::v_noabi::document::value create_index(v_noabi::client_session const &session, bsoncxx::v_noabi::document::view_or_value keys, bsoncxx::v_noabi::document::view_or_value index_options={}, v_noabi::options::index_view operation_options={})
Creates an index over the collection for the provided keys with the provided options.
Definition collection.hpp:570
void drop(bsoncxx::v_noabi::stdx::optional< v_noabi::write_concern > const &write_concern={}, bsoncxx::v_noabi::document::view_or_value collection_options={})
Drops this collection and all its contained documents from the database.
v_noabi::cursor find(bsoncxx::v_noabi::document::view_or_value filter, v_noabi::options::find const &options={})
Finds the documents in this collection which match the provided filter.
v_noabi::search_index_view search_indexes()
Gets a search_index_view to the collection.
bsoncxx::v_noabi::stdx::optional< v_noabi::result::bulk_write > bulk_write(container_type const &writes, v_noabi::options::bulk_write const &options={})
Sends a container of writes to the server as a bulk write operation.
Definition collection.hpp:339
bsoncxx::v_noabi::stdx::optional< v_noabi::result::update > update_one(bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value update, v_noabi::options::update const &options={})
Updates a single document matching the provided filter in this collection.
v_noabi::cursor list_indexes(v_noabi::client_session const &session) const
Returns a list of the indexes currently on this collection.
v_noabi::index_view indexes()
Gets an index_view to the collection.
bsoncxx::v_noabi::stdx::string_view name() const
Returns the name of this collection.
std::int64_t estimated_document_count(v_noabi::options::estimated_document_count const &options={})
Returns an estimate of the number of documents in the collection.
v_noabi::cursor aggregate(v_noabi::pipeline const &pipeline, v_noabi::options::aggregate const &options={})
Runs an aggregation framework pipeline against this collection.
v_noabi::change_stream watch(v_noabi::options::change_stream const &options={})
Gets a change stream on this collection with an empty pipeline. Change streams are only supported wit...
bsoncxx::v_noabi::stdx::optional< v_noabi::result::delete_result > delete_many(bsoncxx::v_noabi::document::view_or_value filter, v_noabi::options::delete_options const &options={})
Deletes all matching documents from the collection.
bsoncxx::v_noabi::stdx::optional< v_noabi::result::bulk_write > write(v_noabi::client_session const &session, v_noabi::model::write const &write, v_noabi::options::bulk_write const &options={})
Sends a write to the server as a bulk write operation.
Definition collection.hpp:309
bsoncxx::v_noabi::stdx::optional< v_noabi::result::insert_one > insert_one(bsoncxx::v_noabi::document::view_or_value document, v_noabi::options::insert const &options={})
Inserts a single document into the collection. If the document is missing an identifier (_id field) o...
bsoncxx::v_noabi::stdx::optional< v_noabi::result::insert_many > insert_many(container_type const &container, v_noabi::options::insert const &options={})
Inserts multiple documents into the collection. If any of the documents are missing identifiers the d...
Definition collection.hpp:1192
bsoncxx::v_noabi::stdx::optional< v_noabi::result::delete_result > delete_one(bsoncxx::v_noabi::document::view_or_value filter, v_noabi::options::delete_options const &options={})
Deletes a single matching document from the collection.
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::value > find_one(bsoncxx::v_noabi::document::view_or_value filter, v_noabi::options::find const &options={})
Finds a single document in this collection that match the provided filter.
bsoncxx::v_noabi::stdx::optional< v_noabi::result::insert_many > insert_many(document_view_iterator_type begin, document_view_iterator_type end, v_noabi::options::insert const &options={})
Inserts multiple documents into the collection. If any of the documents are missing identifiers the d...
Definition collection.hpp:1251
v_noabi::read_preference read_preference() const
Gets the read_preference for the collection.
v_noabi::bulk_write create_bulk_write(v_noabi::options::bulk_write const &options={})
Creates a new bulk operation to be executed against this collection. The lifetime of the bulk_write i...
std::int64_t count_documents(bsoncxx::v_noabi::document::view_or_value filter, v_noabi::options::count const &options={})
Counts the number of documents matching the provided filter.
v_noabi::cursor distinct(bsoncxx::v_noabi::string::view_or_value name, bsoncxx::v_noabi::document::view_or_value filter, v_noabi::options::distinct const &options={})
Finds the distinct values for a specified field across the collection.
bsoncxx::v_noabi::stdx::optional< v_noabi::result::insert_many > insert_many(v_noabi::client_session const &session, document_view_iterator_type begin, document_view_iterator_type end, v_noabi::options::insert const &options={})
Inserts multiple documents into the collection. If any of the documents are missing identifiers the d...
Definition collection.hpp:1280
v_noabi::read_concern read_concern() const
Gets the read_concern for the collection.
void rename(bsoncxx::v_noabi::string::view_or_value new_name, bool drop_target_before_rename=false, bsoncxx::v_noabi::stdx::optional< v_noabi::write_concern > const &write_concern={})
Rename this collection.
collection() noexcept
Default constructs a collection object. The collection is equivalent to the state of a moved from col...
Definition collection.hpp:123
collection(collection &&other) noexcept=default
Move constructs a collection.
void read_preference(v_noabi::read_preference rp)
Sets the read_preference for this collection. Changes will not have any effect on existing cursors or...
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::value > find_one_and_delete(bsoncxx::v_noabi::document::view_or_value filter, v_noabi::options::find_one_and_delete const &options={})
Finds a single document matching the filter, deletes it, and returns the original.
bsoncxx::v_noabi::stdx::optional< v_noabi::result::update > update_many(bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value update, v_noabi::options::update const &options={})
Updates multiple documents matching the provided filter in this collection.
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::value > find_one_and_replace(bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value replacement, v_noabi::options::find_one_and_replace const &options={})
Finds a single document matching the filter, replaces it, and returns either the original or the repl...
bsoncxx::v_noabi::stdx::optional< v_noabi::result::bulk_write > bulk_write(v_noabi::client_session const &session, container_type const &writes, v_noabi::options::bulk_write const &options={})
Sends a container of writes to the server as a bulk write operation.
Definition collection.hpp:370
v_noabi::write_concern write_concern() const
Gets the write_concern for the collection.
bsoncxx::v_noabi::stdx::optional< v_noabi::result::bulk_write > write(v_noabi::model::write const &write, v_noabi::options::bulk_write const &options={})
Sends a write to the server as a bulk write operation.
Definition collection.hpp:280
collection & operator=(collection &&other) noexcept=default
Move assigns a collection.
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::value > find_one_and_update(bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value update, v_noabi::options::find_one_and_update const &options={})
Finds a single document matching the filter, updates it, and returns either the original or the newly...
A cursor over the documents returned by a query to a MongoDB server.
Definition cursor.hpp:50
A MongoDB index.
Definition index_view.hpp:50
bsoncxx::v_noabi::stdx::optional< std::string > create_one(bsoncxx::v_noabi::document::view_or_value const &keys, bsoncxx::v_noabi::document::view_or_value const &index_options={}, v_noabi::options::index_view const &options={})
Creates an index. A convenience method that calls create_many.
Definition index_view.hpp:122
A single write operation for use with mongocxx::v_noabi::bulk_write.
Definition write.hpp:45
Used by mongocxx::v_noabi::collection.
Definition bulk_write.hpp:45
Used by change streams.
Definition change_stream.hpp:52
Used by MongoDB index view operations.
Definition index_view.hpp:45
Used by mongocxx::v_noabi::collection.
Definition insert.hpp:44
A MongoDB aggregation pipeline.
Definition pipeline.hpp:45
Controls the consistency and isolation properties of data read from replica sets and sharded clusters...
Definition read_concern.hpp:54
Describes how MongoDB clients route read operations to the members of a replica set or sharded cluste...
Definition read_preference.hpp:59
A MongoDB Atlas Search Index.
Definition search_index_view.hpp:48
The level of acknowledgment requested for write operations to a MongoDB server.
Definition write_concern.hpp:54
Provides concatenators for use with "streaming" BSON builder syntax.
Provides mongocxx::v_noabi::options::count.
Provides mongocxx::v_noabi::options::distinct.
Provides bsoncxx::v_noabi::document::view_or_value.
Provides mongocxx::v_noabi::options::estimated_document_count.
Provides mongocxx::v_noabi::options::find.
Provides mongocxx::v_noabi::options::find_one_and_delete.
Provides mongocxx::v_noabi::options::find_one_and_replace.
Provides mongocxx::v_noabi::options::find_one_and_update.
Provides mongocxx::v_noabi::options::index.
Provides mongocxx::v_noabi::index_view.
Provides mongocxx::v_noabi::options::insert.
Provides mongocxx::v_noabi::result::insert_many.
Declares bsoncxx::v_noabi::builder::basic::kvp.
Provides mongocxx::v_noabi::model::insert_one.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
Declares entities used with "basic" BSON builder syntax.
v_noabi::document::value make_document(Args &&... args)
Creates a document from a list of key-value pairs.
Definition document.hpp:118
std::tuple< T &&, U && > kvp(T &&t, U &&u)
Constructs a key-value pair from a string key and a BSON value.
Definition kvp.hpp:31
v_noabi::view_or_value< v_noabi::document::view, v_noabi::document::value > view_or_value
Equivalent to v_noabi::view_or_value<v_noabi::document::view, v_noabi::document::value>.
Definition view_or_value.hpp:30
Declares C++17 standard library polyfills.
The top-level namespace within which all bsoncxx library entities are declared.
Declares entities whose ABI stability is guaranteed for documented symbols.
Declares entities representing options to use with various commands.
Declares entities whose ABI stability is NOT guaranteed.
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
The top-level namespace within which all mongocxx library entities are declared.
Provides mongocxx::v_noabi::options::delete_options.
Provides mongocxx::v_noabi::options::index_view.
Provides mongocxx::v_noabi::options::update.
Provides mongocxx::v_noabi::options::replace.
Provides mongocxx::v_noabi::result::delete_result.
Provides mongocxx::v_noabi::result::insert_one.
Provides mongocxx::v_noabi::result::replace_one.
Provides mongocxx::v_noabi::result::update.
Provides mongocxx::v_noabi::search_index_view.
Provides bsoncxx::v_noabi::string::view_or_value.
Provides mongocxx::v1::collection.
Provides bsoncxx::v_noabi::document::value.
Provides bsoncxx::v_noabi::oid.
Provides std::optional-related polyfills for library API usage.
Provides std::string_view-related polyfills for library API usage.
Declares mongocxx::v_noabi::bulk_write.
Provides mongocxx::v_noabi::bulk_write.
Provides mongocxx::v_noabi::change_stream.
Declares mongocxx::v_noabi::client_encryption.
Provides mongocxx::v_noabi::client_session.
Declares mongocxx::v_noabi::collection.
Provides mongocxx::v_noabi::cursor.
Declares mongocxx::v_noabi::database.
Provides mongocxx::v_noabi::options::bulk_write.
Provides mongocxx::v_noabi::options::change_stream.
Provides mongocxx::v_noabi::pipeline.
Provides mongocxx::v_noabi::read_concern.
Provides mongocxx::v_noabi::read_preference.
Provides mongocxx::v_noabi::result::bulk_write.
Provides mongocxx::v_noabi::write_concern.
Provides mongocxx::v_noabi::model::write.