0

I'm looking into using mongodb for a pub-sub model. I went through different articles like http://tugdualgrall.blogspot.fr/2015/01/how-to-create-pubsub-application-with.html and https://jpaljasma.blogspot.com/2013/11/howto-mongodb-tailable-cursors-in-nodejs.html.

I had a question on the numberOfRetries option on the cursor. If i set the option {'numberOfRetries': -1} will this ensure that the cursor will not timeout? Which means that i'll be able to get any new documents inserted into the capped collection even if there was a long delay in a document getting added to the collection?

Thanks.

user320550
  • 1,093
  • 6
  • 20
  • 37

1 Answers1

0

You can set a cursor flag, specifically the noCursorTimeout flag:

let cursor = collection.find({}, ...).addCursorFlag('noCursorTimeout', true);
robertklep
  • 198,204
  • 35
  • 394
  • 381
  • thanks for your reply. So if i use `noCursorTimeout`, then should i use the `numberOfRetries` option also? – user320550 Apr 28 '17 at 19:00
  • @user320550 I think `numberOfRetries` has been deprecated, I can't find it anymore in any recent documentation. – robertklep Apr 28 '17 at 19:23