Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1372

Avoid or optimize RawBSONDocument usage in ChangeStream

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6
    • Affects Version/s: None
    • Component/s: Query Operations
    • None

      Since a $changeStream resumeToken contains a UUID and a user document's _id, the ChangeStream cursor added in PYTHON-1338 uses RawBSONDocument to ensure that the resumeToken can be exactly round-tripped to the server. If the server changes the format of the resumeToken to something that can always be round-tripped then ChangeStream can stop using RawBSONDocument.

      If the server does not change the format, we should optimize the current implementation. For example, it might be more efficient to use aggregate_raw_batches() and work with bson bytes instead of through RawBSONDocument.

      Another optimization may be to add a RawBSONDocument method to retrieve a single field. That way ChangeStream can extract the resumeToken without decoding all the other top level fields in the document.

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: