MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
mongocxx::cursor Class Reference

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

Description

A cursor over the documents returned by a query to a MongoDB server.

Clients can iterate through a cursor::iterator to retrieve results.

Note
By default, cursors timeout after 10 minutes of inactivity.

Classes

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

Public Member Functions

 cursor (cursor &&other) noexcept
 Move constructs a cursor.
 cursor (cursor const &other)=delete
 This class is not copyable.
 cursor (v1::cursor cursor)
 Construct with the mongocxx::v1 equivalent.
 ~cursor ()
 Destroys a cursor.
iterator begin ()
 A cursor::iterator points to the beginning of any available results.
iterator end ()
 A cursor::iterator indicating cursor exhaustion, meaning that no documents are available from the cursor.
 operator v1::cursor () &&
 Convert to the mongocxx::v1 equivalent.
 operator v1::cursor () const &=delete
 This class is not copyable.
cursoroperator= (cursor &&other) noexcept
 Move assigns a cursor.
cursoroperator= (cursor const &other)=delete
 This class is not copyable.

Constructor & Destructor Documentation

◆ cursor() [1/3]

mongocxx::v_noabi::cursor::cursor ( cursor && other)
noexcept

Move constructs a cursor.

◆ cursor() [2/3]

mongocxx::v_noabi::cursor::cursor ( cursor const & other)
delete

This class is not copyable.

◆ cursor() [3/3]

Construct with the mongocxx::v1 equivalent.

◆ ~cursor()

Destroys a cursor.

Member Function Documentation

◆ begin()

A cursor::iterator points to the beginning of any available results.

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

For a non-tailable cursor, when cursor.begin() == cursor.end(), no more documents can be obtained with the cursor. Calling begin() will always return end().

For a tailable cursor, when cursor.begin() == cursor.end(), no document is currently available. However, a subsequent call to begin() will request for more available documents.

Returns
the cursor::iterator
Exceptions
mongocxx::v_noabi::query_exceptionif the query failed

◆ end()

A cursor::iterator indicating cursor exhaustion, meaning that no documents are available from the cursor.

Returns
the cursor::iterator

◆ operator v1::cursor() [1/2]

mongocxx::v_noabi::cursor::operator v1::cursor ( ) &&
inlineexplicit

Convert to the mongocxx::v1 equivalent.

Postconditions:
  • *this is in an assign-or-destroy-only state.
Warning
Invalidates all associated iterators and views.

◆ operator v1::cursor() [2/2]

mongocxx::v_noabi::cursor::operator v1::cursor ( ) const &
explicitdelete

This class is not copyable.

◆ operator=() [1/2]

cursor & mongocxx::v_noabi::cursor::operator= ( cursor && other)
noexcept

Move assigns a cursor.

◆ operator=() [2/2]

cursor & mongocxx::v_noabi::cursor::operator= ( cursor const & other)
delete

This class is not copyable.


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