[SERVER-66808] Remove undocumented fields from the change stream error Created: 26/May/22  Updated: 29/Oct/23  Resolved: 06/Jul/22

Status: Closed
Project: Core Server
Component/s: Change streams
Affects Version/s: 6.0.0-rc7
Fix Version/s: 6.0.1, 6.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Katya Kamenieva Assignee: Catalin Sumanaru
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.0
Sprint: QE 2022-06-27, QE 2022-07-11
Participants:

 Description   

When change stream errors because pre-image is not available it returns `preImageId` and `rawOplogUpdateSpec`.

Open a change stream with pre or post image required on a collection that doesn't have pre-images enabled

watch = db.col.aggregate([{ $changeStream: { fullDocument: "required"} }]) 

Make an update to collection

db.col.insertOne({a:1})
db.col.updateOne({}, {$set: {a:2}})

Read the change stream

watch.tryNext() 

For update event it produces an error like this if you requested post-image:

MongoServerError: Executor error during getMore :: caused by :: Change stream was configured to require a post-image for all update, delete and replace events, but the post-image was not found for event: {rawOplogUpdateSpec: {$v: 2, diff: {u: {a: 2}}}, _id: {_data: "82628FB979000000012B022C0100296E5A1004EC71121BA6E44B5D97FB01ED73D7A21046645F69640064628FB966D440719E7C9887A00004"}, operationType: "update", clusterTime: Timestamp(1653586297, 1), wallTime: 2022-05-26T17:31:37.351Z, preImageId: {nsUUID: BinData(4, "EC71121BA6E44B5D97FB01ED73D7A210"), ts: Timestamp(1653586297, 1), applyOpsIndex: 0}, ns: {db: "test", coll: "col"}, documentKey: {_id: 628fb966d440719e7c9887a0}, updateDescription: {updatedFields: {a: 2}, removedFields: [], truncatedArrays: []}}

Or like this if pre-image was requested:

MongoServerError: Executor error during getMore :: caused by :: Change stream was configured to require a pre-image for all update, delete and replace events, but the pre-image was not found for event: {rawOplogUpdateSpec: {$v: 2, diff: {u: {a: 2}}}, _id: {_data: "82628FB90E000000012B022C0100296E5A1004E544309D04C54ACDA8D747782D1ADB5446645F69640064628FB908D440719E7C98879F0004"}, operationType: "update", clusterTime: Timestamp(1653586190, 1), wallTime: 2022-05-26T17:29:50.395Z, preImageId: {nsUUID: BinData(4, "E544309D04C54ACDA8D747782D1ADB54"), ts: Timestamp(1653586190, 1), applyOpsIndex: 0}, ns: {db: "test", coll: "col"}, documentKey: {_id: 628fb908d440719e7c98879f}, updateDescription: {updatedFields: {a: 2}, removedFields: [], truncatedArrays: []}}

 



 Comments   
Comment by Githook User [ 25/Jul/22 ]

Author:

{'name': 'csum112', 'email': 'catalin.sumanaru@mongodb.com'}

Message: SERVER-66808 Remove undocumented fields from the change stream error
Branch: v6.0
https://github.com/mongodb/mongo/commit/83caa2a5ec49ef1617859461e93b46331c09033a

Comment by Githook User [ 05/Jul/22 ]

Author:

{'name': 'csum112', 'email': 'catalin.sumanaru@mongodb.com'}

Message: SERVER-66808 Remove undocumented fields from the change stream error
Branch: master
https://github.com/mongodb/mongo/commit/91a4179916a8627f8e492a2a6e26dc4679033842

Generated at Thu Feb 08 06:06:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.