Rewind the cursor to the first result

- « MongoDB\Driver\Cursor::next

- MongoDB\Driver\Cursor::setTypeMap »

- PHP Manual
- MongoDB\Driver\Cursor
- Rewind the cursor to the first result

# MongoDB\Driver\Cursor::rewind

(mongodb >=1.9.0)

MongoDB\Driver\Cursor::rewind — Rewind the cursor to the first result

### Description

public MongoDB\Driver\Cursor::rewind(): void

If the cursor has advanced beyond its first position, it can no longer be rewound.

### Parameters

This function has no parameters.

### Return Values

`null`.

### Errors/Exceptions

- Throws MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors.
- Throws MongoDB\Driver\Exception\ConnectionException if connection to the server fails (for reasons other than authentication).
- Throws MongoDB\Driver\Exception\AuthenticationException if authentication is needed and fails.
- Throws MongoDB\Driver\Exception\LogicException if this method is called after the cursor has advanced beyond its first position.

### See Also

- Iterator::rewind() - Rewind the Iterator to the first element