Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-4801

Accessing ChangeStreamDocument.FullDocumentBeforeChange throw if pre-image was already expired

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 2.22.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      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.

            Assignee:
            oleksandr.poliakov@mongodb.com Oleksandr Poliakov
            Reporter:
            oleksandr.poliakov@mongodb.com Oleksandr Poliakov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: