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

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

## Description

A MongoDB cursor.

See also
  - Cursors (MongoDB Manual)

## Classes

class | iterator
| An iterator over the results of an associated cursor. More...

## Public Types

enum class | type
| Enumeration identifying the type of the cursor. More...

## Public Member Functions

| cursor (cursor &&other) noexcept
| Move constructor.
| cursor (cursor const &)=delete
| This class is not copyable.
| ~cursor ()
| Destroy this object.
iterator | begin ()
| Return an iterator over the results of the associated cursor.
iterator | end () const
| Return an end iterator.
cursor & | operator= (cursor &&other) noexcept
| Move assignment.
cursor & | operator= (cursor const &)=delete
| This class is not copyable.

## Member Enumeration Documentation

## type

enum class mongocxx::v1::cursor::type

strong

Enumeration identifying the type of the cursor.

Enumerator
k_non_tailable | A non-tailable cursor.
k_tailable | A tailable cursor.
k_tailable_await | A tailable "awaitData" cursor.

## Constructor & Destructor Documentation

## ~cursor()

mongocxx::v1::cursor::~cursor | ( |  | ) |

Destroy this object.

Warning
  Invalidates all associated views and iterators.

## cursor() [1/2]

mongocxx::v1::cursor::cursor | ( | cursor && | other | ) |

noexcept

Move constructor.

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

## cursor() [2/2]

mongocxx::v1::cursor::cursor | ( | cursor const & |  | ) |

delete

This class is not copyable.

## Member Function Documentation

## begin()

iterator mongocxx::v1::cursor::begin | ( |  | ) |

Return an iterator over the results of the associated cursor.

Important
  All iterators associated with the same cursor object share the same state.

This function advances the underlying cursor to obtain the first available result document. The underlying cursor is only advanced at most once: consecutive calls to this->begin() do not advance the underlying cursor state. To obtain subsequent available result documents, the resulting iterator must be incremented instead.

When an iterator compares equal to this->end(), a non-tailable cursor will no longer return any documents: this->begin() == this->end() will always be true. However, a tailable cursor may request additional result documents by calling this->begin() again: the behavior is the same as the first call to this->begin().

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

## end()

cursor::iterator mongocxx::v1::cursor::end | ( |  | ) | const

inline

Return an end iterator.

Important
  The end iterator has no associated cursor.

## operator=() [1/2]

cursor & mongocxx::v1::cursor::operator= | ( | cursor && | other | ) |

noexcept

Move assignment.

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

## operator=() [2/2]

cursor & mongocxx::v1::cursor::operator= | ( | cursor const & |  | ) |

delete

This class is not copyable.

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

- mongocxx/v1/cursor.hpp