MongoServerError: cursor id 1234567890 not found (CursorNotFound)
A cursor you were iterating timed out or was killed on the server, so the next batch fails.
cursor id not foundMongoServerError: cursor id 1234567890 not foundCursorNotFound: cursor id not found on serverMongoCursorNotFoundError: Cursor not found (id:getMore command failed: Cursor not found 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
- Paginate:
find({_id: {$gt: last}}).sort({_id:1}).limit(1000) - Lower
batchSizeor process faster noCursorTimeout: trueand always close the cursor
Detailed fix by platform
mongosh
db.coll.find().batchSize(500)orcursor.noCursorTimeout()withcursor.close()
How to diagnose
- Idle — Time between batches?
- Failover — Occurred?
- Pagination — Used?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Atlas: bad auth: Authentication failed MongoServerError: bad auth : Authentication failed. (Atlas user / special characters in password)
- BSONObj size is invalid / exceeds maximum document size (16MB) MongoServerError: BSONObj size: 17825792 (0x1100000) is invalid. Size must be between 0 and 16793600(16MB)
- Can't connect from another host (bindIp 127.0.0.1) MongoDB: connection refused / timed out from a remote host — mongod bindIp defaults to 127.0.0.1
Most viewed in MongoDB
- Document failed validation MongoDB: MongoServerError: Document failed validation (code 121)
- MongoParseError MongoDB: MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"
- bad auth : Authentication failed MongoDB: MongoServerError: bad auth : Authentication failed (code 8000 / 18)
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026