I encountered an issue where tailable cursors don't work properly in ruby driver version 2.16.3. When consuming the cursor, it exits after all documents are read rather than awaiting for further ones.
From what I saw in the driver code, after the cursor is created it's already treated as closed, because it has id 0. This issue doesn't occur on version 2.15.1 or earlier.
Environment details:
- mongo 3.2
- ruby 3.2.2
Reproduction steps:
- Create a capped collection `capped` in `test` db
- Ensure there's at least one document in it
- Prepare a `Gemfile with appropriate `mongo` gem version
- Run `bundle exec ruby consumer.rb` in background (producer.rb attached)
- Run `bundle exec ruby producer.rb`
For version 2.15.1: `bundle exec ruby consumer.rb` prints all the documents and then, whenever `bundle exec ruby producer.rb` is run, it prints the newly added document
For version 2.16.3: `bundle exec ruby consumer.rb` prints all the documents and then exits