Loading...
Searching...
No Matches
mongocxx::change_stream Class Reference

`#include <mongocxx/v_noabi/mongocxx/change_stream.hpp>`

## Description

A MongoDB change stream.

## Classes

class | iterator
| A MongoDB change stream iterator. More...

## Public Member Functions

| change_stream (change_stream &&other) noexcept
| Move constructs a change_stream.
| change_stream (change_stream const &other)=delete
| This class is not copyable.
| change_stream (v1::change_stream stream)
| Construct with the mongocxx::v1 equivalent.
| ~change_stream ()
| Destroys a change_stream.
iterator | begin () const
| A change_stream::iterator points to the beginning of any available notifications.
iterator | end () const
| A change_stream::iterator indicating stream exhaustion, meaning that no notifications are available from the stream.
bsoncxx::v1::stdx::optional< bsoncxx::v_noabi::document::view > | get_resume_token () const
| Returns a resume token for this change stream.
| operator v1::change_stream () &&
| Convert to the bsoncxx::v1 equivalent.
| operator v1::change_stream () const &=delete
| This class is not copyable.
change_stream & | operator= (change_stream &&other) noexcept
| Move assigns a change_stream.
change_stream & | operator= (change_stream const &other)=delete
| This class is not copyable.

## Constructor & Destructor Documentation

## change_stream() [1/3]

mongocxx::v_noabi::change_stream::change_stream | ( | change_stream && | other | ) |

noexcept

Move constructs a change_stream.

## change_stream() [2/3]

mongocxx::v_noabi::change_stream::change_stream | ( | change_stream const & | other | ) |

delete

This class is not copyable.

## change_stream() [3/3]

mongocxx::v_noabi::change_stream::change_stream | ( | v1::change_stream | stream | ) |

inline

Construct with the mongocxx::v1 equivalent.

## ~change_stream()

mongocxx::v_noabi::change_stream::~change_stream | ( |  | ) |

Destroys a change_stream.

## Member Function Documentation

## begin()

iterator mongocxx::v_noabi::change_stream::begin | ( |  | ) | const

A change_stream::iterator points to the beginning of any available notifications.

The first call to begin() advances to the next available notification. Consecutive calls to begin() only advance to the next available notification at most once. The state of all iterators is tracked by the change_stream itself, so advancing one iterator advances all iterators.

change_stream::begin() and increment operators may block if the current batch of documents is exhausted. They will not return until a notification is available, the max_await_time (from the options::change_stream) milliseconds have elapsed, or a server error is encountered.

When change_stream.begin() == change_stream.end(), no notifications are available. Each call to change_stream.begin() checks again for newly-available notifications and advances (once) to the next available notification.

Returns
  The change_stream::iterator

Exceptions

  Throws | mongocxx::v_noabi::query_exception if the query failed.

Warning
  This function is NOT logically const despite the const-qualifier.

## end()

iterator mongocxx::v_noabi::change_stream::end | ( |  | ) | const

A change_stream::iterator indicating stream exhaustion, meaning that no notifications are available from the stream.

Returns
  The change_stream::iterator indicating exhaustion

## get_resume_token()

bsoncxx::v1::stdx::optional< bsoncxx::v_noabi::document::view > mongocxx::v_noabi::change_stream::get_resume_token | ( |  | ) | const

inline

Returns a resume token for this change stream.

If the change stream has not been iterated, and either resume_after or start_after was specified in the options to this change stream, the specified value will be returned by this method. If neither resume_after or start_after was set on the options for this change stream, and it has not been iterated, this method will return no token.

Once this change stream has been iterated, this method will return the resume token of the most recently returned document in the stream, or a postBatchResumeToken if the current batch of documents has been exhausted.

See also
  - https://www.mongodb.com/docs/manual/changeStreams/#resume-tokens

The returned document::view is valid for the lifetime of the stream and its data may be updated if the change stream is iterated after this function. The value may be copied to extend its lifetime or preserve the current resume token.

Returns
  The token.

## operator v1::change_stream() [1/2]

mongocxx::v_noabi::change_stream::operator v1::change_stream | ( |  | ) | &&

inline explicit

Convert to the bsoncxx::v1 equivalent.

Postconditions:
  - *this is in an assign-or-destroy-only state.

Warning
  Invalidates all associated iterators and views.

## operator v1::change_stream() [2/2]

mongocxx::v_noabi::change_stream::operator v1::change_stream | ( |  | ) | const &

explicit delete

This class is not copyable.

## operator=() [1/2]

change_stream & mongocxx::v_noabi::change_stream::operator= | ( | change_stream && | other | ) |

noexcept

Move assigns a change_stream.

## operator=() [2/2]

change_stream & mongocxx::v_noabi::change_stream::operator= | ( | change_stream const & | other | ) |

delete

This class is not copyable.

The documentation for this class was generated from the following file:

- mongocxx/v_noabi/mongocxx/change_stream.hpp