Using pymongo tailable cursors dies on empty collections
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Riding Sky Waves v001
--
Chapters
00:00 Using Pymongo Tailable Cursors Dies On Empty Collections
01:51 Accepted Answer Score 1
02:11 Thank you
--
Full question
https://stackoverflow.com/questions/1032...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #mongodb #pymongo
#avk47
    Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Riding Sky Waves v001
--
Chapters
00:00 Using Pymongo Tailable Cursors Dies On Empty Collections
01:51 Accepted Answer Score 1
02:11 Thank you
--
Full question
https://stackoverflow.com/questions/1032...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #mongodb #pymongo
#avk47
ACCEPTED ANSWER
Score 1
This is known behavior, and the 2 loops "solution" is the accepted practice to work around this case. In the case that the collection is empty, rather than immediately retrying and entering a tight loop as you suggest, you can sleep for a short time (especially if you expect that there will soon be data to tail).