Skip to content

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Aug 25, 2025

When running the command bin/console doctrine:mongodb:encryption:dump-fields-map the min/max option of field query must match the field type.

But when we read the field map from the collection metadata, the long values are automatically converted to int.

In this PR, in manipulate the exported extends JSON to ensure the option value has the expected type.

Same issue as doctrine/mongodb-odm#2805

@GromNaN GromNaN requested a review from jmikola August 25, 2025 12:51
@GromNaN GromNaN mentioned this pull request Aug 25, 2025
11 tasks
@GromNaN GromNaN requested a review from Copilot August 25, 2025 17:09
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a type mismatch issue in the MongoDB encryption fields map dump command where query options (min/max) for encrypted fields were being automatically converted to incorrect BSON types by the PHP driver.

  • Corrects BSON type conversion for long and decimal field types in query options
  • Switches from relaxed to canonical extended JSON to preserve original type information
  • Ensures min/max query option types match their corresponding field types

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copilot

This comment was marked as resolved.

@GromNaN GromNaN merged commit 235b64d into doctrine:feature/queryable-encryption Aug 26, 2025
15 checks passed
// The min/max query options must have the same type as the field.
// But the PHP driver always convert to "int" or "float" when the value fit in the range
foreach ($encryptedFieldsMap as $ns => $encryptedFields) {
$fields = json_decode(PackedArray::fromPHP($encryptedFields['fields'])->toCanonicalExtendedJSON(), true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GromNaN GromNaN deleted the encryption-type branch August 28, 2025 14:40
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