-
Type: New Feature
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
(copied to CRM)
Python's ChangeStream implementation provides a single method, next, to retrieve the next document. next loops forever running getMores until the server returns the next document.
We could add a way to request the next document without running multiple getMores with a try_next method equivalent to Java's tryNext (JAVA-2968) and Ruby's try_next, which runs a single getMore and returns the next document or None.
change_stream = # Create change stream while change_stream.alive: change = change_stream.try_next() if change is None: # No new changes, do something else... pass else: # Process the next change print(change)
- causes
-
PYTHON-1792 Test failure - test_try_next and test_try_next_runs_one_getmore
- Closed
-
MOTOR-337 Update watch helpers for PyMongo 3.8 try_next api
- Closed
- is related to
-
PYTHON-1742 Support postBatchResumeToken in change streams
- Closed