Skip to content

MONGOCRYPT-937 restore prefixPreview and suffixPreview#1191

Merged
kevinAlbs merged 1 commit into
mongodb:masterfrom
kevinAlbs:M937
Jun 17, 2026
Merged

MONGOCRYPT-937 restore prefixPreview and suffixPreview#1191
kevinAlbs merged 1 commit into
mongodb:masterfrom
kevinAlbs:M937

Conversation

@kevinAlbs

@kevinAlbs kevinAlbs commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #1184 to restore support for "prefixPreview" and "suffixPreview".

Details

Server 9.0-dev errors if trying to create a collection using encryptedFields with "prefixPreview" or "suffixPreview":

Cannot create a collection with an encrypted field with query type prefixPreview, as it is deprecated

Servers 8.2 to pre-9.0 only support "prefixPreview" or "suffixPreview".

#1184 changed libmongocrypt to error if "prefixPreview" or "suffixPreview" was set as a query type for explicit encryption, or seen in the encryptedFields for auto encryption.

To support pre-9.0 auto-encryption, an encryptedFields specifying "prefixPreview" and "suffixPreview" must not error in libmongocrypt to continue supporting pre-9.0 servers.

To support pre-9.0 explicit-encryption, "prefix" and "suffix" query types can technically be used, since there is no difference in the resulting payload. But "prefixPreview" and "suffixPreview" is restored for consistency with the pre-8.0 server.

Motivation

This is intended to avoid dropping support for preview in drivers too early before a 9.0 stable release. Requested in this slack thread.

Testing

Changes in #1184 resulted in redundant explicit encryption tests testing "prefix" and "suffix" twice. The redundant tests are updated to test preview and the descriptions clarify if testing "(preview)" or "(stable)".

@kevinAlbs kevinAlbs requested a review from mdb-ad June 17, 2026 12:56
@kevinAlbs kevinAlbs marked this pull request as ready for review June 17, 2026 12:56
@kevinAlbs kevinAlbs requested a review from a team as a code owner June 17, 2026 12:56
@kevinAlbs kevinAlbs merged commit 15714bd into mongodb:master Jun 17, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants