Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-66508

Make explain handling consistent between csfle and mongocryptd

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.1, 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • v6.0
    • Security 2022-05-30, Security 2022-06-13, Security 2022-06-27

      Background & Motivation

      The current expectations of the "explain" command differ between csfle and mongocryptd.

      mongocryptd expects "encryptionInformation" as a sibling of "explain":

      {
          "explain": {
              "find": "foo"
          },
          "encryptionInformation": { "fields": [] },
          "$db": "db" // Appended by driver.
      }
      

      csfle expects "encryptionInformation" nested in "explain":

      {
          "explain": {
              "find": "foo",
              "encryptionInformation": { "fields": [] },
              "$db": "db"
          },
          "$db": "db"
      }
      

      mongocryptd and csfle return "encryptionInformation" nested in "explain". Neither csfle nor mongocryptd return "$db" in the reply.

      csfle requires a "$db" field be nested in the "explain" document matching the top-level "$db".

      mongod and mongos expect "encryptionInformation" nested in "explain".

      This is not urgent. libmongocrypt works around this in MONGOCRYPT-427. The consistent behavior would help simplify libmongocrypt auto encryption logic.

      Proposed Scope

      • csfle should parse "encryptionInformation" as either a sibling of "explain" or nested inside "explain". Allowing both supports the old behavior and new behavior.
      • csfle should not require "$db" nested inside "explain".

            Assignee:
            erwin.pe@mongodb.com Erwin Pe
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: