Loading...
Searching...
No Matches
mongocxx::cursor::iterator Class Reference

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

## Description

An input iterator of documents in a MongoDB cursor result set.

All non-end iterators derived from the same mongocxx::v_noabi::cursor move in lock-step. Dereferencing any non-end() iterator always gives the first remaining document in the cursor. Incrementing one non-end iterator is equivalent to incrementing them all.

An iterator is 'exhausted' when no documents are available. An end-iterator is always exhausted. A non-end iterator is exhausted when the originating mongocxx::v_noabi::cursor has no more documents. When an iterator is exhausted, it must not be dereferenced or incremented.

For iterators of a tailable cursor, calling cursor.begin() may revive an exhausted iterator so that it no longer compares equal to the end-iterator.

## Public Types

using | value_type = bsoncxx::v_noabi::document::view
| std::iterator_traits

## Public Member Functions

bsoncxx::v_noabi::document::view const & | operator* () const
| Dereferences the view for the document currently being pointed to.
iterator & | operator++ ()
| Pre-increments the iterator to move to the next document.
void | operator++ (int)
| Post-increments the iterator to move to the next document.
bsoncxx::v_noabi::document::view const * | operator-> () const
| Accesses a member of the dereferenced document currently being pointed to.

## Related Symbols

(Note that these are not member symbols.)
bool | operator== (iterator const &, iterator const &)
| Compare two iterators for (in)-equality. Iterators compare equal if they point to the same underlying cursor or if both are exhausted.
bool | operator!= (cursor::iterator const &lhs, cursor::iterator const &rhs) noexcept
| Compare two iterators for (in)-equality. Iterators compare equal if they point to the same underlying cursor or if both are exhausted.

## Member Typedef Documentation

## value_type

using mongocxx::v_noabi::cursor::iterator::value_type = bsoncxx::v_noabi::document::view

std::iterator_traits

## Member Function Documentation

## operator*()

bsoncxx::v_noabi::document::view const & mongocxx::v_noabi::cursor::iterator::operator* | ( |  | ) | const

Dereferences the view for the document currently being pointed to.

## operator++() [1/2]

iterator & mongocxx::v_noabi::cursor::iterator::operator++ | ( |  | ) |

Pre-increments the iterator to move to the next document.

Exceptions

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

## operator++() [2/2]

void mongocxx::v_noabi::cursor::iterator::operator++ | ( | int |  | ) |

inline

Post-increments the iterator to move to the next document.

Exceptions

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

## operator->()

bsoncxx::v_noabi::document::view const * mongocxx::v_noabi::cursor::iterator::operator-> | ( |  | ) | const

Accesses a member of the dereferenced document currently being pointed to.

## Friends And Related Symbol Documentation

## operator!=

bool operator!= | ( | cursor::iterator const & | lhs,
|  | cursor::iterator const & | rhs )

friend

Compare two iterators for (in)-equality. Iterators compare equal if they point to the same underlying cursor or if both are exhausted.

## operator==

bool operator== | ( | iterator const & | ,
|  | iterator const & | )

friend

Compare two iterators for (in)-equality. Iterators compare equal if they point to the same underlying cursor or if both are exhausted.

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

- mongocxx/v_noabi/mongocxx/cursor.hpp