[SERVER-65324] Allow comparisons of encrypted fields to expressions which resolve to constants Created: 07/Apr/22 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Hana Pearlman | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Assigned Teams: |
Query Optimization
|
||||
| Participants: | |||||
| Description |
|
Currently, there is a restriction where encrypted fields can only be compared to constant expressions, e.g.: {$expr: {$eq: ["encryptedInt", {$add: [1, 2, 3]}]}} This ticket is to extend support to expressions which resolve to constants, for example: {$expr: {$eq: ["encryptedInt", {$cond: [{$eq: [$unencrypted, "abc"]}, 2, 3]}]}}. The work required to support this is 1) allowing comparisons to expressions other than ExpressionConstant in query analysis (though we should still try to make sure the comparison will resolve to a constant) and 2) adding a new rewrite on the server-side to support more complicated query shapes. |