MongoDB C++ Driver 4.4.0
Loading...
Searching...
No Matches
change_stream.hpp
Go to the documentation of this file.
1// Copyright 2009-present MongoDB, Inc.
2//
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/change_stream-fwd.hpp> // IWYU pragma: export
18
19//
20
22
24
30
32
33#include <chrono>
34#include <cstddef>
35#include <cstdint>
36#include <iterator>
37#include <string>
38
39namespace mongocxx {
40namespace v1 {
41
49 private:
50 class impl;
51 void* _impl;
52
53 public:
54 class options;
55
56 class iterator;
57
64
72
80
84 change_stream(change_stream const&) = delete;
85
89 change_stream& operator=(change_stream const&) = delete;
90
105
111 iterator end() const;
112
118 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) get_resume_token() const;
119
134
148 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) try_next();
149
150 class internal;
151
152 private:
153 /* explicit(false) */ change_stream(void* impl);
154};
155
171 private:
172 class impl;
173 void* _impl;
174
175 public:
182
190
197 MONGOCXX_ABI_EXPORT_CDECL(options&) operator=(options&& other) noexcept;
198
203
207 MONGOCXX_ABI_EXPORT_CDECL(options&) operator=(options const& other);
208
216
221
225 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<std::int32_t>) batch_size() const;
226
231
235 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) collation() const;
236
241
245 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::types::view>) comment() const;
246
251
255 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::stdx::string_view>) full_document() const;
256
261
266 const;
267
271 MONGOCXX_ABI_EXPORT_CDECL(options&) max_await_time(std::chrono::milliseconds v);
272
276 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<std::chrono::milliseconds>) max_await_time() const;
277
282
288 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) resume_after() const;
289
294
298 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) start_after() const;
299
304
308 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::types::b_timestamp>) start_at_operation_time()
309 const;
310
311 class internal;
312};
313
328 private:
329 void* _impl; // v1::change_stream
330
331 public:
335 using iterator_category = std::input_iterator_tag;
336
341
345 using difference_type = std::ptrdiff_t;
346
350 using pointer = value_type const*;
351
356
363
371
378 MONGOCXX_ABI_EXPORT_CDECL(iterator&) operator=(iterator&& other) noexcept;
379
384
388 MONGOCXX_ABI_EXPORT_CDECL(iterator&) operator=(iterator const& other);
389
394
401
409
424
426 iterator& operator++(int) {
427 return this->operator++();
428 }
429
438 friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(iterator const& lhs, iterator const& rhs);
439
443 friend bool operator!=(iterator const& lhs, iterator const& rhs) {
444 return !(lhs == rhs);
445 }
446
447 class internal;
448
449 private:
450 /* explicit(false) */ iterator(void* impl);
451};
452
454 return {};
455}
456
457} // namespace v1
458} // namespace mongocxx
459
461
A non-owning, read-only BSON document.
Definition view.hpp:52
An iterator over change stream events.
Definition change_stream.hpp:327
std::ptrdiff_t difference_type
Provide std::iterator_traits<T>::difference_type.
Definition change_stream.hpp:345
friend bool operator!=(iterator const &lhs, iterator const &rhs)
Equivalent to !(lhs == rhs).
Definition change_stream.hpp:443
value_type reference
Provide std::iterator_traits<T>::reference.
Definition change_stream.hpp:355
iterator(iterator &&other) noexcept
Move construction.
value_type const * pointer
Provide std::iterator_traits<T>::pointer.
Definition change_stream.hpp:350
bsoncxx::v1::document::view value_type
Provide std::iterator_traits<T>::value_type.
Definition change_stream.hpp:340
iterator & operator++()
Increment this iterator.
friend bool operator==(iterator const &lhs, iterator const &rhs)
Equality comparison.
std::input_iterator_tag iterator_category
Provide std::iterator_traits<T>::iterator_category.
Definition change_stream.hpp:335
Options for mongocxx::v1::change_stream.
Definition change_stream.hpp:170
options & collation(bsoncxx::v1::document::value v)
Set the "collation" option.
options & batch_size(std::int32_t v)
Set the "batchSize" option.
options & start_at_operation_time(bsoncxx::v1::types::b_timestamp v)
Set the "startAtOperationTime" option.
options(options &&other) noexcept
Move constructor.
options & resume_after(bsoncxx::v1::document::value v)
Set the "resumeAfter" option.
options & start_after(bsoncxx::v1::document::value v)
Set the "startAfter" option.
options & max_await_time(std::chrono::milliseconds v)
Set the "maxAwaitTimeMS" option.
options & comment(bsoncxx::v1::types::value v)
Set the "comment" option.
options & full_document_before_change(std::string v)
Set the "fullDocumentBeforeChange" option.
options & full_document(std::string v)
Set the "fullDocument" option.
~change_stream()
Destroy this object.
change_stream(change_stream &&other) noexcept
Move constructor.
bsoncxx::v1::stdx::optional< bsoncxx::v1::document::view > get_resume_token() const
Return the resume token for this change stream.
iterator end() const
Return an end iterator.
Definition change_stream.hpp:453
bsoncxx::v1::document::view next()
Obtain the next event document.
iterator begin()
Return an iterator associated with this change stream.
bsoncxx::v1::stdx::optional< bsoncxx::v1::document::view > try_next()
Try to obtain the next event document.
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 whose ABI stability is guaranteed for documented symbols.
The top-level namespace within which all mongocxx library entities are declared.
Declares mongocxx::v1::change_stream.
Declares bsoncxx::v1::document::value.
Provides bsoncxx::v1::document::view.
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 non-owning, read-only entities representing a BSON type value.