[SERVER-66508] Make explain handling consistent between csfle and mongocryptd Created: 16/May/22  Updated: 29/Oct/23  Resolved: 21/Jun/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.1, 6.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Kevin Albertson Assignee: Erwin Pe
Resolution: Fixed Votes: 0
Labels: csfle
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
is depended on by MONGOCRYPT-462 Remove workarounds for explain differ... Backlog
Related
is related to MONGOCRYPT-427 Fix explain for FLE1 with csfle and FLE2 Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v6.0
Sprint: Security 2022-05-30, Security 2022-06-13, Security 2022-06-27
Participants:

 Description   

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".


 Comments   
Comment by Githook User [ 26/Jul/22 ]

Author:

{'name': 'Erwin Pe', 'email': 'erwin.pe@mongodb.com', 'username': 'erwee'}

Message: SERVER-66508 Make explain handling consistent between csfle and mongocryptd

(cherry picked from commit 63797e16f28512b49f9fc593c3579220ea8c09f5)
Branch: v6.0
https://github.com/10gen/mongo-enterprise-modules/commit/7e371e3a34c1ed91942cb292d1ed254de8db0045

Comment by Githook User [ 21/Jun/22 ]

Author:

{'name': 'Erwin Pe', 'email': 'erwin.pe@mongodb.com', 'username': 'erwee'}

Message: SERVER-66508 Make explain handling consistent between csfle and mongocryptd
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/63797e16f28512b49f9fc593c3579220ea8c09f5

Generated at Thu Feb 08 06:05:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.