# MongoServerError: cursor id 1234567890 not found (CursorNotFound)

**Code:** `CursorNotFound: cursor id not found` · **Category:** MongoDB · **Seen on:** MongoDB, Node.js

A cursor you were iterating timed out or was killed on the server, so the next batch fails.

## Meaning

Server cursors time out after 10 minutes of inactivity. Slow per-document processing between batches triggers this. Fix by processing faster, using smaller batches (`batchSize`), `noCursorTimeout` with explicit close (careful), paginating with `_id > lastId`, or storing results then processing.

## Common causes

- Processing each doc slowly while iterating
- Cursor idle for over 10 minutes
- Server restarted/failed over
- Cursor killed manually
- Using a huge `find()` without pagination

## Quick fix

1. Paginate: `find({_id: {$gt: last}}).sort({_id:1}).limit(1000)`
2. Lower `batchSize` or process faster
3. `noCursorTimeout: true` and always close the cursor

## Detailed fix by platform

### mongosh

1. `db.coll.find().batchSize(500)` or `cursor.noCursorTimeout()` with `cursor.close()`

## How to diagnose

1. **Idle** — Time between batches?
2. **Failover** — Occurred?
3. **Pagination** — Used?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/mongodb/cursor-not-found-cursor-id-xx-not-found)
