22 #include <bsoncxx/builder/basic/array.hpp> 23 #include <bsoncxx/builder/basic/document.hpp> 24 #include <bsoncxx/builder/basic/kvp.hpp> 25 #include <bsoncxx/builder/concatenate.hpp> 26 #include <bsoncxx/document/view_or_value.hpp> 27 #include <bsoncxx/oid.hpp> 28 #include <bsoncxx/stdx/optional.hpp> 29 #include <bsoncxx/string/view_or_value.hpp> 30 #include <mongocxx/bulk_write.hpp> 31 #include <mongocxx/cursor.hpp> 32 #include <mongocxx/index_view.hpp> 33 #include <mongocxx/model/insert_one.hpp> 34 #include <mongocxx/options/aggregate.hpp> 35 #include <mongocxx/options/bulk_write.hpp> 36 #include <mongocxx/options/count.hpp> 37 #include <mongocxx/options/delete.hpp> 38 #include <mongocxx/options/distinct.hpp> 39 #include <mongocxx/options/find.hpp> 40 #include <mongocxx/options/find_one_and_delete.hpp> 41 #include <mongocxx/options/find_one_and_replace.hpp> 42 #include <mongocxx/options/find_one_and_update.hpp> 43 #include <mongocxx/options/index.hpp> 44 #include <mongocxx/options/index_view.hpp> 45 #include <mongocxx/options/insert.hpp> 46 #include <mongocxx/options/update.hpp> 47 #include <mongocxx/read_concern.hpp> 48 #include <mongocxx/read_preference.hpp> 49 #include <mongocxx/result/bulk_write.hpp> 50 #include <mongocxx/result/delete.hpp> 51 #include <mongocxx/result/insert_many.hpp> 52 #include <mongocxx/result/insert_one.hpp> 53 #include <mongocxx/result/replace_one.hpp> 54 #include <mongocxx/result/update.hpp> 55 #include <mongocxx/write_concern.hpp> 57 #include <mongocxx/config/prelude.hpp> 60 MONGOCXX_INLINE_NAMESPACE_BEGIN
62 using bsoncxx::builder::basic::kvp;
63 using bsoncxx::builder::basic::make_document;
64 using bsoncxx::builder::concatenate;
123 explicit operator bool()
const noexcept;
178 MONGOCXX_INLINE stdx::optional<result::bulk_write> write(
202 template <
typename container_type>
203 MONGOCXX_INLINE stdx::optional<result::bulk_write>
bulk_write(
228 template <
typename write_model_iterator_type>
229 MONGOCXX_INLINE stdx::optional<result::bulk_write>
bulk_write(
230 write_model_iterator_type begin,
231 write_model_iterator_type end,
305 stdx::optional<result::delete_result> delete_many(
325 stdx::optional<result::delete_result> delete_one(
364 void drop(
const bsoncxx::stdx::optional<mongocxx::write_concern>&
write_concern = {});
400 stdx::optional<bsoncxx::document::value> find_one(
420 stdx::optional<bsoncxx::document::value> find_one_and_delete(
444 stdx::optional<bsoncxx::document::value> find_one_and_replace(
469 stdx::optional<bsoncxx::document::value> find_one_and_update(
489 stdx::optional<result::insert_one> insert_one(
516 template <
typename container_type>
517 MONGOCXX_INLINE stdx::optional<result::insert_many> insert_many(
544 template <
typename document_view_iterator_type>
545 MONGOCXX_INLINE stdx::optional<result::insert_many> insert_many(
546 document_view_iterator_type begin,
547 document_view_iterator_type end,
559 cursor list_indexes()
const;
567 stdx::string_view name()
const;
586 bool drop_target_before_rename =
false,
587 const bsoncxx::stdx::optional<write_concern>&
write_concern = {});
650 stdx::optional<result::replace_one> replace_one(
732 class MONGOCXX_PRIVATE impl;
734 MONGOCXX_PRIVATE impl& _get_impl();
735 MONGOCXX_PRIVATE
const impl& _get_impl()
const;
737 std::unique_ptr<impl> _impl;
743 writes.append(
write);
748 template <
typename container_type>
749 MONGOCXX_INLINE stdx::optional<result::bulk_write> collection::bulk_write(
751 return bulk_write(requests.begin(), requests.end(), options);
754 template <
typename write_model_iterator_type>
755 MONGOCXX_INLINE stdx::optional<result::bulk_write> collection::bulk_write(
756 write_model_iterator_type begin,
757 write_model_iterator_type end,
761 std::for_each(begin, end, [&](
const model::write& current) { writes.append(current); });
766 template <
typename container_type>
769 return insert_many(container.begin(), container.end(), options);
772 template <
typename document_view_iterator_type>
774 document_view_iterator_type begin,
775 document_view_iterator_type end,
797 id_doc.
append(kvp(
"_id", doc[
"_id"].get_value()));
806 return stdx::nullopt;
809 return stdx::optional<result::insert_many>{
813 MONGOCXX_INLINE_NAMESPACE_END
816 #include <mongocxx/config/postlude.hpp> Top level namespace for the MongoDB C++ driver.
Definition: bulk_write.hpp:22
insert & ordered(bool ordered)
Represents a MongoDB ObjectId.
Definition: oid.hpp:38
A read-only BSON document that owns its underlying buffer.
Definition: value.hpp:33
Class representing the optional arguments to a MongoDB query.
Definition: find.hpp:36
bulk_write & write_concern(class write_concern wc)
Sets the write_concern for this operation.
Class representing the result of a MongoDB insert many operation (executed as a bulk write)...
Definition: insert_many.hpp:37
A read-only, non-owning view of a BSON document.
Definition: view.hpp:33
bsoncxx::document::view view() const
Definition: document.hpp:61
Class representing a pointer to the result set of a query on a MongoDB server.
Definition: cursor.hpp:36
bulk_write & ordered(bool ordered)
Sets whether the writes must be executed in order by the server.
Class representing the optional arguments to a MongoDB distinct command.
Definition: distinct.hpp:34
Class representing the optional arguments to a MongoDB bulk write.
Definition: bulk_write.hpp:29
Class representing the optional arguments to a MongoDB insert operation.
Definition: insert.hpp:31
Class representing a MongoDB database.
Definition: database.hpp:46
void append(Arg &&a, Args &&... args)
Appends multiple BSON values.
Definition: sub_array.hpp:50
stdx::optional< result::bulk_write > write(const model::write &write, const options::bulk_write &options=options::bulk_write())
Sends a write to the server as a bulk write operation.
Definition: collection.hpp:740
insert & write_concern(class write_concern wc)
Sets the write_concern for this operation.
Class representing the optional arguments to a MongoDB update operation.
Definition: update.hpp:31
Class representing a batch of write operations that can be sent to the server as a group...
Definition: bulk_write.hpp:41
Class representing the optional arguments to a MongoDB delete operation.
Definition: delete.hpp:30
A traditional builder-style interface for constructing a BSON array.
Definition: array.hpp:35
Class representing a MongoDB aggregation pipeline.
Definition: pipeline.hpp:35
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition: read_preference.hpp:57
Class representing the optional arguments to a MongoDB aggregation operation.
Definition: aggregate.hpp:36
Class representing a view-or-value variant type for strings.
Definition: view_or_value.hpp:36
insert & bypass_document_validation(bool bypass_document_validation)
Sets the bypass_document_validation option.
bsoncxx::array::view view() const
Definition: array.hpp:58
Models a single write operation within a .
Definition: write.hpp:37
Definition: index_view.hpp:31
class bulk_write create_bulk_write(const options::bulk_write &options={})
Creates a new bulk operation to be executed against this collection.
Class representing optional arguments to IndexView operations.
Definition: index_view.hpp:31
void append(Arg &&a, Args &&... args)
Appends multiple basic::kvp key-value pairs.
Definition: sub_document.hpp:46
A class to represent the read concern.
Definition: read_concern.hpp:52
Class representing the optional arguments to a MongoDB find_and_modify replace operation.
Definition: find_one_and_replace.hpp:35
A traditional builder-style interface for constructing a BSON document.
Definition: document.hpp:37
stdx::optional< result::insert_many > insert_many(const container_type &container, const options::insert &options=options::insert())
Inserts multiple documents into the collection.
Definition: collection.hpp:767
Class representing the optional arguments to a MongoDB find_and_modify delete operation.
Definition: find_one_and_delete.hpp:33
bulk_write & bypass_document_validation(bool bypass_document_validation)
Set whether or not to bypass document validation for this operation.
Class representing a MongoDB insert operation that creates a single document.
Definition: insert_one.hpp:28
Class representing the server-side requirement for reporting the success of a write operation...
Definition: write_concern.hpp:55
Class representing the optional arguments to a MongoDB count command.
Definition: count.hpp:36
Class representing the optional arguments to a MongoDB find_and_modify update operation.
Definition: find_one_and_update.hpp:35
Class representing server side document groupings within a MongoDB database.
Definition: collection.hpp:84