-
Type: Question
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: 6.0.13
-
Component/s: None
-
None
-
Query Execution
I am writing a no-passthough jstest opening and closing 960 change stream cursors with different options. The test starts and stops a minimalistic ShardingTest instance (1 mongos, 1 config-mongod, 1 shard-mongod) within the JavaScript file.
I've noticed that changeStreamCursor.hasNext() takes considerably longer (3 to 10 times) when the result is 'false' (no change events to return).
I have no idea if there is some intended waiting in mongo (legacy) shell, or if it is even a problem in the server's getMore command implementation.
For reference, mongosh offers two functions: cursor.hasNext() and cursor.tryNext() and from the docs one can infer that cursor.hasNext() is 'blocking', so it might include some waiting (and a timeout?). mongo (legacy) shell does not have cursor.tryNext() counterpart.