Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB Cursor Not Found [duplicate]

I am using mongodb's (mongoose module) with node js
and i am processing around 1,00,00,000 documents in (1000 bunch each) using limit and skip functionalities.
my processing fine but after some time it gives me an error.

{ MongoError: Cursor not found, cursor id: 62783806111
    at Function.MongoError.create (/home/admin/Pictures/duplicayProj1/node_modules/mongoose/node_modules/mongodb-core/lib/error.js:31:11)
    at /home/admin/Pictures/duplicayProj1/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:483:72
    at authenticateStragglers (/home/admin/Pictures/duplicayProj1/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:429:16)
    at Connection.messageHandler (/home/admin/Pictures/duplicayProj1/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:463:5)
    at Socket.<anonymous> (/home/admin/Pictures/duplicayProj1/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:339:20)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:252:12)
    at readableAddChunk (_stream_readable.js:239:11)
    at Socket.Readable.push (_stream_readable.js:197:10)
    at TCP.onread (net.js:589:20)
  name: 'MongoError',
  message: 'Cursor not found, cursor id: 62783806111',
  ok: 0,
  errmsg: 'Cursor not found, cursor id: 62783806111',
  code: 43 }

can any one tell me what's the actual problem because i am not using any keywords matches with cursor.
Thanks in advance

like image 744
Mohammad Zeeshan Avatar asked Sep 26 '17 10:09

Mohammad Zeeshan


People also ask

Does MongoDB allow duplicates?

While you cannot prevent entries with duplicated data. You can query/aggregate the data in such a way that replicated data is ignored. On the same $group stage you could pick up the max, min, avg etc for a given entry.

How do I remove duplicates in MongoDB?

Duplicate records can be removed from a MongoDB collection by creating a unique index on the collection and specifying the dropDups option. Here is the trace of a session that shows the contents of a collection before and after creating a unique index with dropDups.

How do I get MongoDB cursor?

In MongoDB, the find() method return the cursor, now to access the document we need to iterate the cursor. In the mongo shell, if the cursor is not assigned to a var keyword then the mongo shell automatically iterates the cursor up to 20 documents. MongoDB also allows you to iterate cursor manually.


1 Answers

This normally happens because your cursor timeouts if it is idle for too long. Check out noCursorTimeout. Just make sure you close the cursor when you are finished.

like image 93
hahcho Avatar answered Oct 09 '22 23:10

hahcho