Loading...
Searching...
No Matches
change_stream.hpp
Go to the documentation of this file.
// Copyright 2009-present MongoDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <mongocxx/v1/change_stream-fwd.hpp> // IWYU pragma: export
//
#include <mongocxx/v1/detail/prelude.hpp>
#include <bsoncxx/v1/document/value-fwd.hpp>
#include <bsoncxx/v1/document/view.hpp>
#include <bsoncxx/v1/stdx/optional.hpp>
#include <bsoncxx/v1/stdx/string_view.hpp>
#include <bsoncxx/v1/types/value.hpp>
#include <bsoncxx/v1/types/view.hpp>
#include <mongocxx/v1/config/export.hpp>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <string>
namespace mongocxx {
namespace v1 {
class change_stream {
private:
class impl;
void* _impl;
public:
class options;
class iterator;
MONGOCXX_ABI_EXPORT_CDECL() ~change_stream();
MONGOCXX_ABI_EXPORT_CDECL() change_stream(change_stream&& other) noexcept;
MONGOCXX_ABI_EXPORT_CDECL(change_stream&) operator=(change_stream&& other) noexcept;
change_stream(change_stream const&) = delete;
change_stream& operator=(change_stream const&) = delete;
MONGOCXX_ABI_EXPORT_CDECL(iterator) begin();
iterator end() const;
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) get_resume_token() const;
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::document::view) next();
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) try_next();
class internal;
private:
/* explicit(false) */ change_stream(void* impl);
};
class change_stream::options {
private:
class impl;
void* _impl;
public:
MONGOCXX_ABI_EXPORT_CDECL() ~options();
MONGOCXX_ABI_EXPORT_CDECL() options(options&& other) noexcept;
MONGOCXX_ABI_EXPORT_CDECL(options&) operator=(options&& other) noexcept;
MONGOCXX_ABI_EXPORT_CDECL() options(options const& other);
MONGOCXX_ABI_EXPORT_CDECL(options&) operator=(options const& other);
MONGOCXX_ABI_EXPORT_CDECL() options();
MONGOCXX_ABI_EXPORT_CDECL(options&) batch_size(std::int32_t v);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<std::int32_t>) batch_size() const;
MONGOCXX_ABI_EXPORT_CDECL(options&) collation(bsoncxx::v1::document::value v);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) collation() const;
MONGOCXX_ABI_EXPORT_CDECL(options&) comment(bsoncxx::v1::types::value v);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::types::view>) comment() const;
MONGOCXX_ABI_EXPORT_CDECL(options&) full_document(std::string v);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::stdx::string_view>) full_document() const;
MONGOCXX_ABI_EXPORT_CDECL(options&) full_document_before_change(std::string v);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::stdx::string_view>) full_document_before_change()
const;
MONGOCXX_ABI_EXPORT_CDECL(options&) max_await_time(std::chrono::milliseconds v);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<std::chrono::milliseconds>) max_await_time() const;
MONGOCXX_ABI_EXPORT_CDECL(options&) resume_after(bsoncxx::v1::document::value v);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) resume_after() const;
MONGOCXX_ABI_EXPORT_CDECL(options&) start_after(bsoncxx::v1::document::value v);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) start_after() const;
MONGOCXX_ABI_EXPORT_CDECL(options&) start_at_operation_time(bsoncxx::v1::types::b_timestamp v);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::types::b_timestamp>) start_at_operation_time()
const;
class internal;
};
class change_stream::iterator {
private:
void* _impl; // v1::change_stream
public:
using iterator_category = std::input_iterator_tag;
using value_type = bsoncxx::v1::document::view;
using difference_type = std::ptrdiff_t;
using pointer = value_type const*;
using reference = value_type;
MONGOCXX_ABI_EXPORT_CDECL() ~iterator();
MONGOCXX_ABI_EXPORT_CDECL() iterator(iterator&& other) noexcept;
MONGOCXX_ABI_EXPORT_CDECL(iterator&) operator=(iterator&& other) noexcept;
MONGOCXX_ABI_EXPORT_CDECL() iterator(iterator const& other);
MONGOCXX_ABI_EXPORT_CDECL(iterator&) operator=(iterator const& other);
MONGOCXX_ABI_EXPORT_CDECL() iterator();
MONGOCXX_ABI_EXPORT_CDECL(value_type) operator*() const;
MONGOCXX_ABI_EXPORT_CDECL(pointer) operator->() const;
MONGOCXX_ABI_EXPORT_CDECL(iterator&) operator++();
iterator& operator++(int) {
return this->operator++();
}
friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(iterator const& lhs, iterator const& rhs);
friend bool operator!=(iterator const& lhs, iterator const& rhs) {
return !(lhs == rhs);
}
class internal;
private:
/* explicit(false) */ iterator(void* impl);
};
inline change_stream::iterator change_stream::end() const {
return {};
}
} // namespace v1
} // namespace mongocxx
#include <mongocxx/v1/detail/postlude.hpp>
bsoncxx::v1::document::view
A non-owning, read-only BSON document.
Definition view.hpp:52
mongocxx::v1::change_stream::iterator
An iterator over change stream events.
Definition change_stream.hpp:327
mongocxx::v1::change_stream::iterator::difference_type
std::ptrdiff_t difference_type
Provide std::iterator_traits<T>::difference_type.
Definition change_stream.hpp:345
mongocxx::v1::change_stream::iterator::operator!=
friend bool operator!=(iterator const &lhs, iterator const &rhs)
Equivalent to !(lhs == rhs).
Definition change_stream.hpp:443
mongocxx::v1::change_stream::iterator::reference
value_type reference
Provide std::iterator_traits<T>::reference.
Definition change_stream.hpp:355
mongocxx::v1::change_stream::iterator::iterator
iterator(iterator &&other) noexcept
Move construction.
mongocxx::v1::change_stream::iterator::pointer
value_type const * pointer
Provide std::iterator_traits<T>::pointer.
Definition change_stream.hpp:350
mongocxx::v1::change_stream::iterator::value_type
bsoncxx::v1::document::view value_type
Provide std::iterator_traits<T>::value_type.
Definition change_stream.hpp:340
mongocxx::v1::change_stream::iterator::~iterator
~iterator()
Destroy this object.
mongocxx::v1::change_stream::iterator::operator++
iterator & operator++()
Increment this iterator.
mongocxx::v1::change_stream::iterator::operator==
friend bool operator==(iterator const &lhs, iterator const &rhs)
Equality comparison.
mongocxx::v1::change_stream::iterator::iterator_category
std::input_iterator_tag iterator_category
Provide std::iterator_traits<T>::iterator_category.
Definition change_stream.hpp:335
mongocxx::v1::change_stream::options
Options for mongocxx::v1::change_stream.
Definition change_stream.hpp:170
mongocxx::v1::change_stream::options::collation
options & collation(bsoncxx::v1::document::value v)
Set the "collation" option.
mongocxx::v1::change_stream::options::batch_size
options & batch_size(std::int32_t v)
Set the "batchSize" option.
mongocxx::v1::change_stream::options::start_at_operation_time
options & start_at_operation_time(bsoncxx::v1::types::b_timestamp v)
Set the "startAtOperationTime" option.
mongocxx::v1::change_stream::options::options
options(options &&other) noexcept
Move constructor.
mongocxx::v1::change_stream::options::resume_after
options & resume_after(bsoncxx::v1::document::value v)
Set the "resumeAfter" option.
mongocxx::v1::change_stream::options::start_after
options & start_after(bsoncxx::v1::document::value v)
Set the "startAfter" option.
mongocxx::v1::change_stream::options::max_await_time
options & max_await_time(std::chrono::milliseconds v)
Set the "maxAwaitTimeMS" option.
mongocxx::v1::change_stream::options::comment
options & comment(bsoncxx::v1::types::value v)
Set the "comment" option.
mongocxx::v1::change_stream::options::full_document_before_change
options & full_document_before_change(std::string v)
Set the "fullDocumentBeforeChange" option.
mongocxx::v1::change_stream::options::~options
~options()
Destroy this object.
mongocxx::v1::change_stream::options::full_document
options & full_document(std::string v)
Set the "fullDocument" option.
mongocxx::v1::change_stream::~change_stream
~change_stream()
Destroy this object.
mongocxx::v1::change_stream::change_stream
change_stream(change_stream &&other) noexcept
Move constructor.
mongocxx::v1::change_stream::get_resume_token
bsoncxx::v1::stdx::optional< bsoncxx::v1::document::view > get_resume_token() const
Return the resume token for this change stream.
mongocxx::v1::change_stream::end
iterator end() const
Return an end iterator.
Definition change_stream.hpp:453
mongocxx::v1::change_stream::next
bsoncxx::v1::document::view next()
Obtain the next event document.
mongocxx::v1::change_stream::begin
iterator begin()
Return an iterator associated with this change stream.
mongocxx::v1::change_stream::try_next
bsoncxx::v1::stdx::optional< bsoncxx::v1::document::view > try_next()
Try to obtain the next event document.
export.hpp
Provides macros to control the set of symbols exported in the ABI.
MONGOCXX_ABI_EXPORT_CDECL
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
postlude.hpp
The mongocxx v1 macro guard postlude header.
prelude.hpp
The mongocxx v1 macro guard prelude header.
bsoncxx
The top-level namespace within which all bsoncxx library entities are declared.
mongocxx::v1
Declares entities whose ABI stability is guaranteed for documented symbols.
mongocxx
The top-level namespace within which all mongocxx library entities are declared.
change_stream-fwd.hpp
Declares mongocxx::v1::change_stream.
value-fwd.hpp
Declares bsoncxx::v1::document::value.
view.hpp
Provides bsoncxx::v1::document::view.
optional.hpp
Provides std::optional-related polyfills for library API usage.
string_view.hpp
Provides std::string_view-related polyfills for library API usage.
value.hpp
Provides bsoncxx::v1::types::value.
view.hpp
Provides non-owning, read-only entities representing a BSON type value.