[MongoDB] How to Resolve Error: getMore: cursor didn't exist on server, possible restart or timeout?

Tadashi Shigeoka ·  Thu, May 24, 2018

I’ll introduce how to resolve the Error: getMore: cursor didn’t exist on server, possible restart or timeout? that occurs with MongoDB queries.

MongoDB | モンゴディービー

MongoDB Query Performance Tuning

Timeouts occur because MongoDB query execution time is long.

Check Items

  • Are indexes defined on fields?
  • Are you doing extravagant full table scans (loop processing)?

Check and improve points where query execution time is taking too long.

Specify the noTimeout Option

If the timeout error doesn’t resolve even after MongoDB query performance tuning, use cursor.addOption() to specify the noTimeout option and disable timeout.

db.collection.find().addOption(DBQuery.Option.noTimeout)

That’s all from the Gemba where I was troubled by MongoDB query timeouts.

Reference Information