Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-37669

Allow change streams to project out the resume token

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated: