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

Avoid or optimize RawBSONDocument usage in ChangeStream

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6
    • Component/s: Query Operations
    • Labels:
      None

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: