MongoDB C++ Driver 4.4.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
35
42
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
82 private:
83 class impl;
84 void* _impl;
85
86 template <typename Container>
87 using has_begin_expr = decltype((std::declval<Container const&>().begin()));
88
89 template <typename Container>
90 struct has_begin : bsoncxx::detail::is_detected<has_begin_expr, Container> {};
91
92 template <typename Container>
93 using has_end_expr = decltype((std::declval<Container const&>().end()));
94
95 template <typename Container>
96 struct has_end : bsoncxx::detail::is_detected<has_end_expr, Container> {};
97
98 static void is_write_iter_expr_impl(v1::bulk_write::single) {}
99
100 template <typename InputIt>
101 using is_write_iter_expr = decltype((is_write_iter_expr_impl)(*std::declval<InputIt&>()));
102
103 template <typename InputIt>
104 struct is_write_iter : bsoncxx::detail::is_detected<is_write_iter_expr, InputIt> {};
105
106 template <typename Sentinel, typename InputIt>
107 struct is_sentinel_for : bsoncxx::detail::is_equality_comparable<Sentinel, InputIt> {};
108
109 template <typename Container>
110 struct is_container : bsoncxx::detail::conjunction<has_begin<Container>, has_end<Container>> {};
111
112 static void is_document_iter_expr_impl(bsoncxx::v1::document::view) {}
113
114 template <typename InputIt>
115 using is_document_iter_expr = decltype((is_document_iter_expr_impl)(*std::declval<InputIt&>()));
116
117 template <typename InputIt>
118 struct is_document_iter : bsoncxx::detail::is_detected<is_document_iter_expr, InputIt> {};
119
120 public:
127
135
142 MONGOCXX_ABI_EXPORT_CDECL(collection&) operator=(collection&& other) noexcept;
143
148
153
161
165 explicit MONGOCXX_ABI_EXPORT_CDECL() operator bool() const;
166
175 v1::pipeline const& pipeline,
176 v1::aggregate_options const& opts = {});
177
179 aggregate(v1::client_session const& session, v1::pipeline const& pipeline, v1::aggregate_options const& opts = {});
182
190
192 v1::client_session const& session,
193 v1::bulk_write::options const& opts = {});
196
206
208 v1::client_session const& session,
210 v1::bulk_write::options const& opts = {}) {
211 return this->create_bulk_write(session, opts).append(write).execute();
212 }
213
215
222 template <typename Container, bsoncxx::detail::enable_if_t<is_container<Container>::value>* = nullptr>
224 Container const& writes,
225 v1::bulk_write::options const& opts = {}) {
226 return this->bulk_write(writes.begin(), writes.end(), opts);
227 }
228
235 template <typename Container, bsoncxx::detail::enable_if_t<is_container<Container>::value>* = nullptr>
237 bulk_write(v1::client_session const& session, Container const& writes, v1::bulk_write::options const& opts = {}) {
238 return this->bulk_write(session, writes.begin(), writes.end(), opts);
239 }
240
262 template <
263 typename InputIt,
264 typename Sentinel,
265 bsoncxx::detail::enable_if_t<is_write_iter<InputIt>::value && is_sentinel_for<Sentinel, InputIt>::value>* =
266 nullptr>
268 bulk_write(InputIt begin, Sentinel end, v1::bulk_write::options const& opts = {}) {
269 v1::bulk_write bulk{this->create_bulk_write(opts)};
270 for (auto iter = begin; iter != end; ++iter) {
271 bulk.append(*iter);
272 }
273 return bulk.execute();
274 }
275
276 template <
277 typename InputIt,
278 typename Sentinel,
279 bsoncxx::detail::enable_if_t<is_write_iter<InputIt>::value && is_sentinel_for<Sentinel, InputIt>::value>* =
280 nullptr>
282 v1::client_session const& session,
283 InputIt begin,
284 Sentinel end,
285 v1::bulk_write::options const& opts = {}) {
286 v1::bulk_write bulk{this->create_bulk_write(session, opts)};
287 for (auto iter = begin; iter != end; ++iter) {
288 bulk.append(*iter);
289 }
290 return bulk.execute();
291 }
292
294
308 v1::count_options const& opts = {});
309
310 MONGOCXX_ABI_EXPORT_CDECL(std::int64_t)
312 v1::client_session const& session,
313 bsoncxx::v1::document::view filter,
314 v1::count_options const& opts = {});
317
329 v1::estimated_document_count_options const& opts = {});
330
336 bsoncxx::v1::document::value index_opts = {},
337 v1::indexes::create_one_options const& create_opts = {}) {
338 return this->indexes().create_one(std::move(keys), std::move(index_opts), create_opts);
339 }
340
345 v1::client_session const& session,
347 bsoncxx::v1::document::value index_opts = {},
348 v1::indexes::create_one_options const& create_opts = {}) {
349 return this->indexes().create_one(session, std::move(keys), std::move(index_opts), create_opts);
350 }
351
366 v1::delete_many_options const& opts = {});
367
369 v1::client_session const& session,
371 v1::delete_many_options const& opts = {});
374
389 v1::delete_one_options const& opts = {});
390
393 v1::client_session const& session,
394 bsoncxx::v1::document::view q,
395 v1::delete_one_options const& opts = {});
398
411 bsoncxx::v1::stdx::string_view key,
412 bsoncxx::v1::document::view query,
413 v1::distinct_options const& opts = {});
414
416 v1::client_session const& session,
419 v1::distinct_options const& opts = {});
422
436
438 v1::client_session const& session,
443
455
457 find(v1::client_session const& session, bsoncxx::v1::document::view filter, v1::find_options const& opts = {});
460
475 v1::find_options const& opts = {});
476
478 find_one(v1::client_session const& session, bsoncxx::v1::document::view filter, v1::find_options const& opts = {});
481
498 v1::find_one_and_delete_options const& opts = {});
499
501 v1::client_session const& session,
503 v1::find_one_and_delete_options const& opts = {});
506
524 bsoncxx::v1::document::view replacement,
525 v1::find_one_and_replace_options const& opts = {});
526
528 v1::client_session const& session,
530 bsoncxx::v1::document::view replacement,
531 v1::find_one_and_replace_options const& opts = {});
534
553 v1::find_one_and_update_options const& opts = {});
554
557 v1::pipeline const& update,
558 v1::find_one_and_update_options const& opts = {});
559
561 v1::client_session const& session,
564 v1::find_one_and_update_options const& opts = {});
565
567 v1::client_session const& session,
569 v1::pipeline const& update,
570 v1::find_one_and_update_options const& opts = {});
573
590 v1::insert_one_options const& opts = {});
591
593 v1::client_session const& session,
595 v1::insert_one_options const& opts = {});
598
602 template <typename Container, bsoncxx::detail::enable_if_t<is_container<Container>::value>* = nullptr>
604 Container const& docs,
605 v1::insert_many_options const& opts = {}) {
606 return this->insert_many(docs.begin(), docs.end(), opts);
607 }
608
612 template <typename Container, bsoncxx::detail::enable_if_t<is_container<Container>::value>* = nullptr>
614 insert_many(v1::client_session const& session, Container const& docs, v1::insert_many_options const& opts = {}) {
615 return this->insert_many(session, docs.begin(), docs.end(), opts);
616 }
617
637 template <
638 typename InputIt,
639 typename Sentinel,
640 bsoncxx::detail::enable_if_t<is_document_iter<InputIt>::value && is_sentinel_for<Sentinel, InputIt>::value>* =
641 nullptr>
643 insert_many(InputIt begin, Sentinel end, v1::insert_many_options const& opts = {}) {
644 v1::bulk_write bulk{this->_create_insert_many(nullptr, opts)};
645 std::vector<bsoncxx::v1::types::value> inserted_ids;
646 for (auto iter = begin; iter != end; ++iter) {
647 this->_append_insert_many(bulk, inserted_ids, *iter);
648 }
649 return this->_execute_insert_many(bulk, inserted_ids);
650 }
651
652 template <
653 typename InputIt,
654 typename Sentinel,
655 bsoncxx::detail::enable_if_t<is_document_iter<InputIt>::value && is_sentinel_for<Sentinel, InputIt>::value>* =
656 nullptr>
658 v1::client_session const& session,
659 InputIt begin,
660 Sentinel end,
661 v1::insert_many_options const& opts = {}) {
662 v1::bulk_write bulk{this->_create_insert_many(&session, opts)};
663 std::vector<bsoncxx::v1::types::value> inserted_ids;
664 for (auto iter = begin; iter != end; ++iter) {
665 this->_append_insert_many(bulk, inserted_ids, *iter);
666 }
667 return this->_execute_insert_many(bulk, inserted_ids);
668 }
669
671
676 return this->indexes().list();
677 }
678
683 return this->indexes().list(session);
684 }
685
690
703 bool drop_target = false,
705
707 v1::client_session const& session,
709 bool drop_target = false,
713
724
729
740
745
761 v1::replace_one_options const& opts = {});
762
764 v1::client_session const& session,
767 v1::replace_one_options const& opts = {});
770
786 v1::update_many_options const& opts = {});
787
789 update_many(bsoncxx::v1::document::view filter, v1::pipeline const& update, update_many_options const& opts = {});
790
792 v1::client_session const& session,
795 v1::update_many_options const& opts = {});
796
798 v1::client_session const& session,
800 v1::pipeline const& update,
801 v1::update_many_options const& opts = {});
804
820 v1::update_one_options const& opts = {});
821
823 update_one(bsoncxx::v1::document::view filter, v1::pipeline const& update, update_one_options const& opts = {});
824
826 v1::client_session const& session,
829 v1::update_one_options const& opts = {});
830
832 v1::client_session const& session,
834 v1::pipeline const& update,
835 v1::update_one_options const& opts = {});
838
849
854
862
871
873 v1::client_session const& session,
874 v1::change_stream::options const& opts = {});
877
886 v1::pipeline const& pipeline,
887 v1::change_stream::options const& opts = {});
888
890 watch(v1::client_session const& session, v1::pipeline const& pipeline, v1::change_stream::options const& opts = {});
893
901
905 enum class errc {
908 };
909
913 static MONGOCXX_ABI_EXPORT_CDECL(std::error_category const&) error_category();
914
918 friend std::error_code make_error_code(errc v) {
919 return {static_cast<int>(v), error_category()};
920 }
921
922 class internal;
923
924 private:
925 /* explicit(false) */ collection(void* impl);
926
927 MONGOCXX_ABI_EXPORT_CDECL(v1::bulk_write) _create_insert_many(
928 v1::client_session const* session,
929 v1::insert_many_options const& opts);
930
931 static MONGOCXX_ABI_EXPORT_CDECL(void) _append_insert_many(
932 v1::bulk_write& bulk,
933 std::vector<bsoncxx::v1::types::value>& inserted_ids,
935
937 v1::bulk_write& bulk,
938 std::vector<bsoncxx::v1::types::value>& inserted_ids);
939};
940
941} // namespace v1
942} // namespace mongocxx
943
944namespace std {
945
946template <>
947struct is_error_code_enum<mongocxx::v1::collection::errc> : true_type {};
948
949} // namespace std
950
952
Provides mongocxx::v1::aggregate_options.
A BSON document.
Definition value.hpp:44
A non-owning, read-only BSON document.
Definition view.hpp:52
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:62
Options for a bulk write operation.
Definition bulk_write.hpp:893
A single write operation.
Definition bulk_write.hpp:746
A list of bulk write operations.
Definition bulk_write.hpp:53
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:170
A MongoDB change stream.
Definition change_stream.hpp:48
A MongoDB client session.
Definition client_session.hpp:46
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:207
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:905
@ max_time_u32
The "maxTimeMS" field must be representable as an std::uint32_t.
Definition collection.hpp:907
@ zero
Zero.
Definition collection.hpp:906
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:603
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:281
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:682
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:614
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:643
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:918
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:237
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:657
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:223
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:344
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:334
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:675
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:201
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:268
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:39
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:53
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:429
Support for MongoDB indexes.
Definition indexes.hpp:56
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:929
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:41
Options related to a MongoDB Read Concern.
Definition read_concern.hpp:42
Options related to a MongoDB Read Preference.
Definition read_preference.hpp:47
Options for a "replaceOne" operation.
Definition replace_one_options.hpp:56
Support for MongoDB Atlas Search indexes.
Definition search_indexes.hpp:49
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:47
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:40
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.
Provides mongocxx::v1::write_concern.