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

Allow change streams to project out the resume token

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 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.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: