Uploaded image for project: 'Swift Driver'
  1. Swift Driver
  2. SWIFT-981

ChangeStreamEvent.ns should be an optional

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 2.0
    • Component/s: None
    • Labels:

      Description

      ChangeStreamEvent.ns is a non-optional MongoNamespace. However, invalidate events do not actually have associated namespaces.

      In SWIFT-957, we worked around this issue by storing the namespace of the change stream's parent db/collection in the userInfo of the ChangeStream's BSONDecoder, which makes it available when the ChangeStreamEvent is being decoded. However, this is a bit strange because in the case of a change stream on a client, we have to store an empty, non-optional MongoNamespace in the userInfo.

      We likely never actually hit this logic for a change stream on a client, because per the docs it doesn't seem that invalidate events can actually occur on a deployment-wide change stream: https://docs.mongodb.com/manual/reference/change-events/#change-event-invalidate

      Before our 2.0 release, we should consider whether it makes sense to continue filling in the field by hand for invalidate events, or if we should just make the field optional.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            kaitlin.mahar Kaitlin Mahar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: