MongoDB C++ Driver 4.2.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
51 private:
52 class impl;
53 void* _impl;
54
55 public:
56 class options;
57
58 class iterator;
59
66
74
82
86 change_stream(change_stream const&) = delete;
87
91 change_stream& operator=(change_stream const&) = delete;
92
107
113 iterator end() const;
114
120 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) get_resume_token() const;
121
136
150 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) try_next();
151
152 class internal;
153
154 private:
155 /* explicit(false) */ change_stream(void* impl);
156};
157
175 private:
176 class impl;
177 void* _impl;
178
179 public:
186
194
201 MONGOCXX_ABI_EXPORT_CDECL(options&) operator=(options&& other) noexcept;
202
207
211 MONGOCXX_ABI_EXPORT_CDECL(options&) operator=(options const& other);
212
220
225
229 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<std::int32_t>) batch_size() const;
230
235
239 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) collation() const;
240
245
249 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::types::view>) comment() const;
250
255
259 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::stdx::string_view>) full_document() const;
260
265
270 const;
271
275 MONGOCXX_ABI_EXPORT_CDECL(options&) max_await_time(std::chrono::milliseconds v);
276
280 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<std::chrono::milliseconds>) max_await_time() const;
281
286
292 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) resume_after() const;
293
298
302 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) start_after() const;
303
308
312 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::types::b_timestamp>) start_at_operation_time()
313 const;
314
315 class internal;
316};
317
334 private:
335 void* _impl; // v1::change_stream
336
337 public:
341 using iterator_category = std::input_iterator_tag;
342
347
351 using difference_type = std::ptrdiff_t;
352
356 using pointer = value_type const*;
357
362
369
377
384 MONGOCXX_ABI_EXPORT_CDECL(iterator&) operator=(iterator&& other) noexcept;
385
390
394 MONGOCXX_ABI_EXPORT_CDECL(iterator&) operator=(iterator const& other);
395
400
407
415
430
432 iterator& operator++(int) {
433 return this->operator++();
434 }
435
444 friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(iterator const& lhs, iterator const& rhs);
445
449 friend bool operator!=(iterator const& lhs, iterator const& rhs) {
450 return !(lhs == rhs);
451 }
452
453 class internal;
454
455 private:
456 /* explicit(false) */ iterator(void* impl);
457};
458
460 return {};
461}
462
463} // namespace v1
464} // namespace mongocxx
465
467
A non-owning, read-only BSON document.
Definition view.hpp:54
An iterator over change stream events.
Definition change_stream.hpp:333
std::ptrdiff_t difference_type
Provide std::iterator_traits<T>::difference_type.
Definition change_stream.hpp:351
friend bool operator!=(iterator const &lhs, iterator const &rhs)
Equivalent to !(lhs == rhs).
Definition change_stream.hpp:449
value_type reference
Provide std::iterator_traits<T>::reference.
Definition change_stream.hpp:361
iterator(iterator &&other) noexcept
Move construction.
value_type const * pointer
Provide std::iterator_traits<T>::pointer.
Definition change_stream.hpp:356
bsoncxx::v1::document::view value_type
Provide std::iterator_traits<T>::value_type.
Definition change_stream.hpp:346
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:341
Options for mongocxx::v1::change_stream.
Definition change_stream.hpp:174
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:459
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.