-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Execution
-
Fully Compatible
In SERVER-37786 we banned change stream pipeline which modified or projected-out the _id because the _id is important for the driver protocol. There's no real reason we couldn't allow this, but doing so would require a different protocol, described below.
Original Title
Add Resume Tokens To Cursor Body
Original Description
Resume tokens are currently returned as part of the documents from a change stream. This is useful because it allows users to retrieve the resume token and provide it as an argument later, but it is easy to accidentally remove it via $project or $replaceRoot. In the case of a $replaceRoot the user might replace the _id field with another type and drivers would attempt to use that as a resume token, which would fail at a much later point in time.
To avoid the problem altogether, an array of resume tokens should be provided at the top level of the cursor body, alongside the firstBatch and nextBatch fields. To enable users to retrieve the resume token and to prevent breaking current drivers, the resume token should still be available on each of the change stream documents.
This feature could potentially be implemented alongside SPEC-1122.
- is related to
-
SERVER-37786 Reject change streams which modify or project-out the resume token
- Closed