Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

PHPLIB-1334 Add tests on Logical Query Operators #21

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Jan 11, 2024

Fix PHPLIB-1334

https://www.mongodb.com/docs/manual/reference/operator/query/#logical

  • $and
  • $not (using the syntax, as there is no example)
  • $nor
  • $or

@GromNaN GromNaN requested a review from alcaeus January 11, 2024 13:13
{
"price": {
"$ne": {
"$numberDouble": "1.9899999999999999911"
Copy link
Member Author

@GromNaN GromNaN Jan 11, 2024

Choose a reason for hiding this comment

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

The yaml 1.99 is encoded as { "$numberDouble": "1.9899999999999999911" }

echo MongoDB\BSON\Document::fromPHP(['x' => 1.99])->toCanonicalExtendedJSON();

// { "x" : { "$numberDouble" : "1.9899999999999999911" } }

Copy link
Member

Choose a reason for hiding this comment

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

We could also deviate from the suggested value and choose a value that doesn't have this problem and can be represented exactly (e.g. 0.2).

Copy link
Member Author

@GromNaN GromNaN Jan 12, 2024

Choose a reason for hiding this comment

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

This is not an issue, as the value is always encoded the same way. But it can make tests to fail if we fix this behavior in a future version of the extension.

Tracking in PHPC-2341
Other example: #22 (comment)

@GromNaN GromNaN merged commit 4176b5a into mongodb:0.1 Jan 12, 2024
@GromNaN GromNaN deleted the PHPLIB-1334 branch January 12, 2024 11:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants