- 
    Type:
Bug
 - 
    Resolution: Fixed
 - 
    Priority:
Major - P3
 - 
    Affects Version/s: None
 - 
    Component/s: None
 - 
    None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
After SERVER-37786, the server throws an error when encountering pipelines that remove the resume token. This results in the following error:
ERROR: Encountered an event whose _id field, which contains the resume token, was modified by the pipeline. Modifying the _id field of an event makes it impossible to resume the stream from that point. Only transformations that retain the unmodified _id field are allowed. Expected: { _id: { _data: "825D701823000000172B022C0100296E5A10043323AB0E8D6B41589FC92A7FA0FDF28246645F696400645D70182350CC22333D87EC460004" } } but found: {} (OperationFailure)
Traceback (most recent call last):
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/test/asyncio_tests/__init__.py", line 48, in __call__
    result = self.orig_method()
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/test/asyncio_tests/__init__.py", line 226, in wrapped
    self.loop.run_until_complete(task)
  File "/opt/python/3.7/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/opt/python/3.7/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/test/asyncio_tests/test_asyncio_change_stream.py", line 111, in test_missing_id
    await future
  File "/opt/python/3.7/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/motor/core.py", line 1414, in _next
    return self.delegate.next()
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/.tox/asyncio-py37/lib/python3.7/site-packages/pymongo/change_stream.py", line 226, in next
    doc = self.try_next()
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/.tox/asyncio-py37/lib/python3.7/site-packages/pymongo/change_stream.py", line 280, in try_next
    change = self._cursor._try_next(True)
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/.tox/asyncio-py37/lib/python3.7/site-packages/pymongo/command_cursor.py", line 270, in _try_next
    self._refresh()
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/.tox/asyncio-py37/lib/python3.7/site-packages/pymongo/command_cursor.py", line 206, in _refresh
    False))
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/.tox/asyncio-py37/lib/python3.7/site-packages/pymongo/command_cursor.py", line 140, in __send_message
    operation, self._unpack_response, address=self.__address)
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/.tox/asyncio-py37/lib/python3.7/site-packages/pymongo/mongo_client.py", line 1347, in _run_operation_with_response
    exhaust=exhaust)
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/.tox/asyncio-py37/lib/python3.7/site-packages/pymongo/mongo_client.py", line 1465, in _retryable_read
    return func(session, server, sock_info, slave_ok)
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/.tox/asyncio-py37/lib/python3.7/site-packages/pymongo/mongo_client.py", line 1341, in _cmd
    unpack_res)
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/.tox/asyncio-py37/lib/python3.7/site-packages/pymongo/server.py", line 136, in run_operation_with_response
    _check_command_response(first)
  File "/data/mci/c22b34dcba43ae76565dfa53fe8402b8/src/.tox/asyncio-py37/lib/python3.7/site-packages/pymongo/helpers.py", line 159, in _check_command_response
    raise OperationFailure(msg % errmsg, code, response)
pymongo.errors.OperationFailure: Encountered an event whose _id field, which contains the resume token, was modified by the pipeline. Modifying the _id field of an event makes it impossible to resume the stream from that point. Only transformations that retain the unmodified _id field are allowed. Expected: { _id: { _data: "825D701823000000172B022C0100296E5A10043323AB0E8D6B41589FC92A7FA0FDF28246645F696400645D70182350CC22333D87EC460004" } } but found: {}
system-out:
	
system-err:
	
The test should be updated to expected either of the two error types - InvalidOperation and/or OperationFailure.