Description:
As of this commit, any $changeStream pipeline that either removes or modifies the _id field will fail with an exception. This is because the _id field of each $changeStream event contains the resume token for that event; if it is modified or removed, then it becomes impossible to resume the stream from that point.
Engineering Ticket Description:
For example, this pipeline:
db.x.watch([{$replaceRoot: {newRoot: "$fullDocument"}}])
|
Such a pipeline is incompatible with the drivers protocol, and will fail to resume in the face of a network outage. It is not intended to be supported, so we should ban it to provide a more predictable failure scenario. Now that we have completed SERVER-35904, it shouldn't be very difficult to verify the _id is preserved by the pipeline.