MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
collection.hpp
Go to the documentation of this file.
1//
2// Copyright 2009-present MongoDB, Inc.
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <mongocxx/v1/collection-fwd.hpp> // IWYU pragma: export
18
19//
20
22
36
43
64
65#include <cstdint>
66#include <string>
67#include <system_error>
68#include <type_traits>
69#include <utility>
70#include <vector>
71
72namespace mongocxx {
73namespace v1 {
74
84 private:
85 class impl;
86 void* _impl;
87
88 template <typename Container>
89 using has_begin_expr = decltype((std::declval<Container const&>().begin()));
90
91 template <typename Container>
92 struct has_begin : bsoncxx::detail::is_detected<has_begin_expr, Container> {};
93
94 template <typename Container>
95 using has_end_expr = decltype((std::declval<Container const&>().end()));
96
97 template <typename Container>
98 struct has_end : bsoncxx::detail::is_detected<has_end_expr, Container> {};
99
100 static void is_write_iter_expr_impl(v1::bulk_write::single) {}
101
102 template <typename InputIt>
103 using is_write_iter_expr = decltype((is_write_iter_expr_impl)(*std::declval<InputIt&>()));
104
105 template <typename InputIt>
106 struct is_write_iter : bsoncxx::detail::is_detected<is_write_iter_expr, InputIt> {};
107
108 template <typename Sentinel, typename InputIt>
109 struct is_sentinel_for : bsoncxx::detail::is_equality_comparable<Sentinel, InputIt> {};
110
111 template <typename Container>
112 struct is_container : bsoncxx::detail::conjunction<has_begin<Container>, has_end<Container>> {};
113
114 static void is_document_iter_expr_impl(bsoncxx::v1::document::view) {}
115
116 template <typename InputIt>
117 using is_document_iter_expr = decltype((is_document_iter_expr_impl)(*std::declval<InputIt&>()));
118
119 template <typename InputIt>
120 struct is_document_iter : bsoncxx::detail::is_detected<is_document_iter_expr, InputIt> {};
121
122 public:
129
137
144 MONGOCXX_ABI_EXPORT_CDECL(collection&) operator=(collection&& other) noexcept;
145
150
155
163
167 explicit MONGOCXX_ABI_EXPORT_CDECL() operator bool() const;
168
177 v1::pipeline const& pipeline,
178 v1::aggregate_options const& opts = {});
179
181 aggregate(v1::client_session const& session, v1::pipeline const& pipeline, v1::aggregate_options const& opts = {});
184
192
194 v1::client_session const& session,
195 v1::bulk_write::options const& opts = {});
198
208
210 v1::client_session const& session,
212 v1::bulk_write::options const& opts = {}) {
213 return this->create_bulk_write(session, opts).append(write).execute();
214 }
215
217
224 template <typename Container, bsoncxx::detail::enable_if_t<is_container<Container>::value>* = nullptr>
226 Container const& writes,
227 v1::bulk_write::options const& opts = {}) {
228 return this->bulk_write(writes.begin(), writes.end(), opts);
229 }
230
237 template <typename Container, bsoncxx::detail::enable_if_t<is_container<Container>::value>* = nullptr>
239 bulk_write(v1::client_session const& session, Container const& writes, v1::bulk_write::options const& opts = {}) {
240 return this->bulk_write(session, writes.begin(), writes.end(), opts);
241 }
242
264 template <
265 typename InputIt,
266 typename Sentinel,
267 bsoncxx::detail::enable_if_t<is_write_iter<InputIt>::value && is_sentinel_for<Sentinel, InputIt>::value>* =
268 nullptr>
270 bulk_write(InputIt begin, Sentinel end, v1::bulk_write::options const& opts = {}) {
271 v1::bulk_write bulk{this->create_bulk_write(opts)};
272 for (auto iter = begin; iter != end; ++iter) {
273 bulk.append(*iter);
274 }
275 return bulk.execute();
276 }
277
278 template <
279 typename InputIt,
280 typename Sentinel,
281 bsoncxx::detail::enable_if_t<is_write_iter<InputIt>::value && is_sentinel_for<Sentinel, InputIt>::value>* =
282 nullptr>
284 v1::client_session const& session,
285 InputIt begin,
286 Sentinel end,
287 v1::bulk_write::options const& opts = {}) {
288 v1::bulk_write bulk{this->create_bulk_write(session, opts)};
289 for (auto iter = begin; iter != end; ++iter) {
290 bulk.append(*iter);
291 }
292 return bulk.execute();
293 }
294
296
310 v1::count_options const& opts = {});
311
312 MONGOCXX_ABI_EXPORT_CDECL(std::int64_t)
314 v1::client_session const& session,
315 bsoncxx::v1::document::view filter,
316 v1::count_options const& opts = {});
319
331 v1::estimated_document_count_options const& opts = {});
332
338 bsoncxx::v1::document::value index_opts = {},
339 v1::indexes::create_one_options const& create_opts = {}) {
340 return this->indexes().create_one(std::move(keys), std::move(index_opts), create_opts);
341 }
342
347 v1::client_session const& session,
349 bsoncxx::v1::document::value index_opts = {},
350 v1::indexes::create_one_options const& create_opts = {}) {
351 return this->indexes().create_one(session, std::move(keys), std::move(index_opts), create_opts);
352 }
353
368 v1::delete_many_options const& opts = {});
369
371 v1::client_session const& session,
373 v1::delete_many_options const& opts = {});
376
391 v1::delete_one_options const& opts = {});
392
395 v1::client_session const& session,
396 bsoncxx::v1::document::view q,
397 v1::delete_one_options const& opts = {});
400
413 bsoncxx::v1::stdx::string_view key,
414 bsoncxx::v1::document::view query,
415 v1::distinct_options const& opts = {});
416
418 v1::client_session const& session,
421 v1::distinct_options const& opts = {});
424
438
440 v1::client_session const& session,
445
457
459 find(v1::client_session const& session, bsoncxx::v1::document::view filter, v1::find_options const& opts = {});
462
477 v1::find_options const& opts = {});
478
480 find_one(v1::client_session const& session, bsoncxx::v1::document::view filter, v1::find_options const& opts = {});
483
500 v1::find_one_and_delete_options const& opts = {});
501
503 v1::client_session const& session,
505 v1::find_one_and_delete_options const& opts = {});
508
526 bsoncxx::v1::document::view replacement,
527 v1::find_one_and_replace_options const& opts = {});
528
530 v1::client_session const& session,
532 bsoncxx::v1::document::view replacement,
533 v1::find_one_and_replace_options const& opts = {});
536
555 v1::find_one_and_update_options const& opts = {});
556
559 v1::pipeline const& update,
560 v1::find_one_and_update_options const& opts = {});
561
563 v1::client_session const& session,
566 v1::find_one_and_update_options const& opts = {});
567
569 v1::client_session const& session,
571 v1::pipeline const& update,
572 v1::find_one_and_update_options const& opts = {});
575
592 v1::insert_one_options const& opts = {});
593
595 v1::client_session const& session,
597 v1::insert_one_options const& opts = {});
600
604 template <typename Container, bsoncxx::detail::enable_if_t<is_container<Container>::value>* = nullptr>
606 Container const& docs,
607 v1::insert_many_options const& opts = {}) {
608 return this->insert_many(docs.begin(), docs.end(), opts);
609 }
610
614 template <typename Container, bsoncxx::detail::enable_if_t<is_container<Container>::value>* = nullptr>
616 insert_many(v1::client_session const& session, Container const& docs, v1::insert_many_options const& opts = {}) {
617 return this->insert_many(session, docs.begin(), docs.end(), opts);
618 }
619
639 template <
640 typename InputIt,
641 typename Sentinel,
642 bsoncxx::detail::enable_if_t<is_document_iter<InputIt>::value && is_sentinel_for<Sentinel, InputIt>::value>* =
643 nullptr>
645 insert_many(InputIt begin, Sentinel end, v1::insert_many_options const& opts = {}) {
646 v1::bulk_write bulk{this->_create_insert_many(nullptr, opts)};
647 std::vector<bsoncxx::v1::types::value> inserted_ids;
648 for (auto iter = begin; iter != end; ++iter) {
649 this->_append_insert_many(bulk, inserted_ids, *iter);
650 }
651 return this->_execute_insert_many(bulk, inserted_ids);
652 }
653
654 template <
655 typename InputIt,
656 typename Sentinel,
657 bsoncxx::detail::enable_if_t<is_document_iter<InputIt>::value && is_sentinel_for<Sentinel, InputIt>::value>* =
658 nullptr>
660 v1::client_session const& session,
661 InputIt begin,
662 Sentinel end,
663 v1::insert_many_options const& opts = {}) {
664 v1::bulk_write bulk{this->_create_insert_many(&session, opts)};
665 std::vector<bsoncxx::v1::types::value> inserted_ids;
666 for (auto iter = begin; iter != end; ++iter) {
667 this->_append_insert_many(bulk, inserted_ids, *iter);
668 }
669 return this->_execute_insert_many(bulk, inserted_ids);
670 }
671
673
678 return this->indexes().list();
679 }
680
685 return this->indexes().list(session);
686 }
687
692
705 bool drop_target = false,
707
709 v1::client_session const& session,
711 bool drop_target = false,
715
726
731
742
747
763 v1::replace_one_options const& opts = {});
764
766 v1::client_session const& session,
769 v1::replace_one_options const& opts = {});
772
788 v1::update_many_options const& opts = {});
789
791 update_many(bsoncxx::v1::document::view filter, v1::pipeline const& update, update_many_options const& opts = {});
792
794 v1::client_session const& session,
797 v1::update_many_options const& opts = {});
798
800 v1::client_session const& session,
802 v1::pipeline const& update,
803 v1::update_many_options const& opts = {});
806
822 v1::update_one_options const& opts = {});
823
825 update_one(bsoncxx::v1::document::view filter, v1::pipeline const& update, update_one_options const& opts = {});
826
828 v1::client_session const& session,
831 v1::update_one_options const& opts = {});
832
834 v1::client_session const& session,
836 v1::pipeline const& update,
837 v1::update_one_options const& opts = {});
840
851
856
864
873
875 v1::client_session const& session,
876 v1::change_stream::options const& opts = {});
879
888 v1::pipeline const& pipeline,
889 v1::change_stream::options const& opts = {});
890
892 watch(v1::client_session const& session, v1::pipeline const& pipeline, v1::change_stream::options const& opts = {});
895
903
909 enum class errc {
912 };
913
919 static MONGOCXX_ABI_EXPORT_CDECL(std::error_category const&) error_category();
920
926 friend std::error_code make_error_code(errc v) {
927 return {static_cast<int>(v), error_category()};
928 }
929
930 class internal;
931
932 private:
933 /* explicit(false) */ collection(void* impl);
934
935 MONGOCXX_ABI_EXPORT_CDECL(v1::bulk_write) _create_insert_many(
936 v1::client_session const* session,
937 v1::insert_many_options const& opts);
938
939 static MONGOCXX_ABI_EXPORT_CDECL(void) _append_insert_many(
940 v1::bulk_write& bulk,
941 std::vector<bsoncxx::v1::types::value>& inserted_ids,
943
945 v1::bulk_write& bulk,
946 std::vector<bsoncxx::v1::types::value>& inserted_ids);
947};
948
949} // namespace v1
950} // namespace mongocxx
951
952namespace std {
953
954template <>
955struct is_error_code_enum<mongocxx::v1::collection::errc> : true_type {};
956
957} // namespace std
958
960
Provides mongocxx::v1::aggregate_options.
A BSON document.
Definition value.hpp:46
A non-owning, read-only BSON document.
Definition view.hpp:54
A polyfill for std::optional<T>.
Definition optional.hpp:799
A polyfill for std::string_view.
Definition string_view.hpp:412
Options for an "aggregate" command.
Definition aggregate_options.hpp:64
Options for a bulk write operation.
Definition bulk_write.hpp:910
A single write operation.
Definition bulk_write.hpp:762
A list of bulk write operations.
Definition bulk_write.hpp:55
bulk_write & append(single const &op)
Append a single write operation.
bsoncxx::v1::stdx::optional< result > execute()
Execute the appended operations.
Options for mongocxx::v1::change_stream.
Definition change_stream.hpp:174
A MongoDB change stream.
Definition change_stream.hpp:50
A MongoDB client session.
Definition client_session.hpp:48
v1::read_preference read_preference() const
Return the current default "readPreference" to use for operations on this collection.
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.
Definition collection.hpp:209
v1::change_stream watch(v1::client_session const &session, v1::change_stream::options const &opts={})
Return a change stream subscribed to this collection.
errc
Errors codes which may be returned by mongocxx::v1::collection.
Definition collection.hpp:909
@ max_time_u32
The "maxTimeMS" field must be representable as an std::uint32_t.
Definition collection.hpp:911
@ zero
Zero.
Definition collection.hpp:910
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.
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::write_concern write_concern() const
Return the current default "writeConcern" to use for operations on this collection.
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.
static std::error_category const & error_category()
The error category for mongocxx::v1::collection::errc.
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).
Definition collection.hpp:605
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.
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::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.
v1::change_stream watch(v1::change_stream::options const &opts={})
Return a change stream subscribed to this collection.
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.
Definition collection.hpp:283
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::string_view name() const
Return 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.
v1::read_concern read_concern() const
Return the current default "readConcern" to use for operations on this collection.
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.
v1::cursor list_indexes(v1::client_session const &session)
Equivalent to this->indexes.list(session).
Definition collection.hpp:684
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::search_indexes search_indexes()
Manage Atlas Search Indexes associated with this collection.
void write_concern(v1::write_concern const &wc)
Set the default "writeConcern" to use for operations on this collection.
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.
void read_concern(v1::read_concern const &rc)
Set the default "readConcern" to use for operations on this collection.
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.
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< 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.
collection()
Default initialization.
v1::bulk_write create_bulk_write(v1::bulk_write::options const &opts={})
Create a bulk write operation.
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< 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< 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< 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).
Definition collection.hpp:616
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.
Definition collection.hpp:645
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.
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.
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.
friend std::error_code make_error_code(errc v)
Support implicit conversion to std::error_code.
Definition collection.hpp:926
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< 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::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).
Definition collection.hpp:239
void read_preference(v1::read_preference const &rp)
Set the default "readPreference" to use for operations on this collection.
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::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::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.
Definition collection.hpp:659
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 > bulk_write(Container const &writes, v1::bulk_write::options const &opts={})
Equivalent to this->bulk_write(writes.begin(), writes.begin(), opts).
Definition collection.hpp:225
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< 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).
Definition collection.hpp:346
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.
~collection()
Destroy this object.
v1::cursor aggregate(v1::pipeline const &pipeline, v1::aggregate_options const &opts={})
Run an aggregation framework pipeline.
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.
collection(collection &&other) noexcept
Move constructor.
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).
Definition collection.hpp:336
v1::indexes indexes()
Manage indexes associated with this collection.
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.
v1::cursor list_indexes()
Equivalent to this->indexes.list().
Definition collection.hpp:677
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.
Definition collection.hpp:203
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< v1::bulk_write::result > bulk_write(InputIt begin, Sentinel end, v1::bulk_write::options const &opts={})
Execute multiple write operations.
Definition collection.hpp:270
void drop(bsoncxx::v1::stdx::optional< v1::write_concern > const &wc={}, bsoncxx::v1::document::view opts={})
Drop 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.
v1::cursor find(bsoncxx::v1::document::view filter, v1::find_options const &opts={})
Find documents in this collection matching the given query filter.
Options for a "countDocuments" operation.
Definition count_options.hpp:58
A MongoDB cursor.
Definition cursor.hpp:41
Options for a "deleteMany" operation.
Definition delete_many_options.hpp:53
Options for a "deleteOne" operation.
Definition delete_one_options.hpp:53
Options for a "distinct" command.
Definition distinct_options.hpp:51
Options for an "estimatedDocumentCount" operation.
Definition estimated_document_count_options.hpp:49
Options for a "findOneAndDelete" operation.
Definition find_one_and_delete_options.hpp:59
Options for a "findOneAndReplace" operation.
Definition find_one_and_replace_options.hpp:63
Options for a "findOneAndUpdate" operation.
Definition find_one_and_update_options.hpp:66
Options for a "find" command.
Definition find_options.hpp:72
Options for mongocxx::v1::indexes::create_one.
Definition indexes.hpp:435
Support for MongoDB indexes.
Definition indexes.hpp:58
bsoncxx::v1::stdx::optional< std::string > create_one(bsoncxx::v1::document::value keys, bsoncxx::v1::document::value index_opts={}, create_one_options const &create_opts={})
Equivalent to this->create_one(model(keys, index_opts), create_opts).
Definition indexes.hpp:935
v1::cursor list(list_options const &list_opts={})
Return all indexes in the associated collection.
Options for an "insertMany" operation.
Definition insert_many_options.hpp:49
Options for an "insertOne" operation.
Definition insert_one_options.hpp:48
A MongoDB aggregation pipeline.
Definition pipeline.hpp:43
Options related to a MongoDB Read Concern.
Definition read_concern.hpp:44
Options related to a MongoDB Read Preference.
Definition read_preference.hpp:49
Options for a "replaceOne" operation.
Definition replace_one_options.hpp:56
Support for MongoDB Atlas Search indexes.
Definition search_indexes.hpp:51
Options for an "updateMany" operation.
Definition update_many_options.hpp:58
Options for an "updateOne" operation.
Definition update_one_options.hpp:59
Options related to a MongoDB Write Concern.
Definition write_concern.hpp:49
Provides mongocxx::v1::count_options.
Provides mongocxx::v1::delete_many_options.
Declares mongocxx::v1::delete_many_result.
Provides mongocxx::v1::delete_one_options.
Declares mongocxx::v1::delete_one_result.
Provides mongocxx::v1::distinct_options.
Provides mongocxx::v1::estimated_document_count_options.
Provides mongocxx::v1::find_one_and_delete_options.
Provides mongocxx::v1::find_one_and_replace_options.
Provides mongocxx::v1::find_one_and_update_options.
Provides mongocxx::v1::find_options.
Provides mongocxx::v1::indexes.
Provides mongocxx::v1::insert_many_options.
Provides mongocxx::v1::insert_many_result.
Provides mongocxx::v1::insert_one_options.
Declares mongocxx::v1::insert_one_result.
Provides macros to control the set of symbols exported in the ABI.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v1 macro guard postlude header.
The mongocxx v1 macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
Declares entities representing options to use with various commands.
Declares entities whose ABI stability is guaranteed for documented symbols.
@ mongocxx
From the mongocxx library.
Definition exception.hpp:42
The top-level namespace within which all mongocxx library entities are declared.
Provides mongocxx::v1::replace_one_options.
Declares mongocxx::v1::replace_one_result.
Declares mongocxx::v1::search_indexes.
Provides mongocxx::v1::update_many_options.
Declares mongocxx::v1::update_many_result.
Provides mongocxx::v1::update_one_options.
Declares mongocxx::v1::update_one_result.
Provides entities related to write operations.
Provides mongocxx::v1::change_stream.
Declares mongocxx::v1::client_session.
Declares mongocxx::v1::collection.
Declares mongocxx::v1::cursor.
For internal use only!
Provides bsoncxx::v1::document::value.
Provides bsoncxx::v1::document::view.
Declares mongocxx::v1::pipeline.
Declares mongocxx::v1::read_concern.
Declares mongocxx::v1::read_preference.
Provides std::optional-related polyfills for library API usage.
Provides std::string_view-related polyfills for library API usage.
Provides bsoncxx::v1::types::value.
Declares mongocxx::v1::write_concern.