Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-6671

use `raw: true` when iterating cursors in the state machine

    • None
    • 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?
    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      As a node driver user using automatic encryption,
      I want the driver's FLE implementation to be efficient and accurate,
      So that the performance and accuracy of my application are not impacted.

      The state machine, when fetching data keys and listing collections, creates cursors and exhausts them - only to then serialize each document individually back to BSON bytes to feed into libmongocrypt.  

      This work is unnecessary - if we instead use `{ raw: true }` (or make another internal change to return unserialized documents from cursors), we can feed the output of the cursors directly back into libmongocrypt without an unnecessary deserialization + serialization.

      This also circumvents any JS bson deserializer + serializer type issues (such as https://github.com/mongodb/libmongocrypt/commit/d24dd00bde467a1d12288180f889cf51a42e6d7c, for example).

      User Experience

      Users might see a performance improvement when using auto encryption.

      Dependencies

      n/a

      Risks/Unknowns

      n/a

      Acceptance Criteria

      Implementation Requirements

      • When fetching keys and listing collections in the state machine, iterate the resultant cursors of raw bytes instead of deserialized documents and feed the bytes directly into libmongocrypt.

      Testing Requirements

      • all tests pass.

      Documentation Requirements

      • none.

      Follow Up Requirements

      • none.

            Assignee:
            Unassigned Unassigned
            Reporter:
            bailey.pearson@mongodb.com Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              None
              None
              None
              None