-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
Not Needed
-
Try to access FullDocumentBeforeChange property of change stream change document throws "Unable to cast object of type 'MongoDB.Bson.BsonNull' to type 'MongoDB.Bson.BsonDocument" exception if pre-image for the change was already expired by the cluster.
Steps to reproduce:
1. Set 10 seconds pre-images expiration period:
use admin db.runCommand({ setClusterParameter: { changeStreamOptions: { preAndPostImages: { expireAfterSeconds: 10 } } } })
2. Store some resume token.
3. Make some changes into the collection (including document deletion).
4. Wait for some time to let cluster expire the pre-images.
5. Run change stream and try to access FullDocumentBeforeChange for the deleted document.