Unable to resume change stream when using pipeline as document filter

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 8.0.9
    • Component/s: None
    • None
    • Query Execution
    • ALL
    • Hide

      Updated steps with syntax fixes

      1. Create initial change stream

      db.watch([{ $match : { "fullDocument.filter" : true }}],_, {_}, {fullDocument: "updateLookup"}, {})

      2. Update relevent documents in collection and get resume token

      3. Attempt to resumeAfter the resume token with the same pipeline

      db.watch([{ $match : { "fullDocument.filter" : true }}], {fullDocument: "updateLookup", resumeAfter:'<resume-token-string>'
      • Reporter observed error in description after this step.

      4. Attempt to resume without pipeline

      db.watch({fullDocument: "updateLookup", resumeAfter:'<resume-token-string>'})
      • Reporter observed no error after this step.

      Original text below:


      1. # _db.watch([{ $match : { "fullDocument.filter" : true }

        }],_ {_}

        {fullDocument: "updateLookup"}

        {}){_} to get resume token

      1. _db.watch([{ $match : { "fullDocument.filter" : true }

        }], {fullDocument: "updateLookup", resumeAfter:<token from step 1>}) –> ChangeStreamFatalError_

      2. db.watch({fullDocument: "updateLookup", resumeAfter:<token from step 1>}) --> works
      Show
      Updated steps with syntax fixes 1. Create initial change stream db.watch([{ $match : { "fullDocument.filter" : true }}],_, {_}, {fullDocument: "updateLookup" }, {}) 2. Update relevent documents in collection and get resume token 3. Attempt to resumeAfter the resume token with the same pipeline db.watch([{ $match : { "fullDocument.filter" : true }}], {fullDocument: "updateLookup" , resumeAfter: '<resume-token-string>' Reporter observed error in description after this step. 4. Attempt to resume without pipeline db.watch({fullDocument: "updateLookup" , resumeAfter: '<resume-token-string>' }) Reporter observed no error after this step. Original text below: # _db.watch([{ $match : { "fullDocument.filter" : true } }],_ {_} {fullDocument: "updateLookup"} { }){_} to get resume token _db.watch([{ $match : { "fullDocument.filter" : true } }], {fullDocument: "updateLookup", resumeAfter:<token from step 1>}) –> ChangeStreamFatalError_ db.watch({fullDocument: "updateLookup", resumeAfter:<token from step 1>}) --> works
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • 0

      A change stream cannot be resumed with a resume token when using a `$match` pipeline to filter documents. The following error is raised:

      {{

      {"t":\{"$date":"2025-05-28T11:23:14.569+00:00"}

      ,"s":"W",  "c":"QUERY",    "id":23799,   "ctx":"conn13","msg":"Aggregate command executor error","attr":{"error":{"code":280,"codeName":"ChangeStreamFatalError","errmsg":"cannot resume stream; the resume token was not found. {_data: \"826836F222000000012B042C0100296E5A10041926BFB122484A969C7373B4F22F1AFB463C6F7065726174696F6E54797065003C64656C6574650046646F63756D656E744B657900461E5F69640029000004\"}"},"stats":{},"cmd":{"aggregate":"testCollection","pipeline":[{"$changeStream":{"fullDocument":"updateLookup","resumeAfter":

      {"_data":"826836F221000000092B042C0100296E5A10041926BFB122484A969C7373B4F22F1AFB463C6F7065726174696F6E54797065003C7570646174650046646F63756D656E744B657900461E5F6964002B10000004"}

      }},{"$match":{"$or":[

      {"fullDocument.filter":true}

      ,{"operationType":"delete"}]}}],"cursor":{"batchSize":2147483647},"$db":"testDatabase","$clusterTime":{"clusterTime":{"$timestamp":{"t":1748431394,"i":1}},"signature":{"hash":{"$binary":{"base64":"AAAAAAAAAAAAAAAAAAAAAAAAAAA=","subType":"0"}},"keyId":0}},"lsid":{"id":{"$uuid":"6ba6d71a-8b34-460d-8ae3-daf59dae8855"}},"$readPreference":{"mode":"primaryPreferred"}}}}}}

      The same pipeline works to filter documents when using startAtOperationTime(...) instead of resumeAfter(...). Also does resumeAfter(...) work with the same resume token when the $match pipeline is omitted.

            Assignee:
            Unassigned
            Reporter:
            Pascal Chollet
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: