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

PHPLIB-1341 Add tests on Miscellaneous Query Operators #53

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Jan 24, 2024

@GromNaN GromNaN requested a review from jmikola January 24, 2024 13:43
$pipeline = new Pipeline(
Stage::match(
Query::comment('Don\'t allow negative inputs.'),
x: Query::gt(0),
Copy link
Member Author

@GromNaN GromNaN Jan 24, 2024

Choose a reason for hiding this comment

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

Named arguments must be after positional arguments, even when we use variadic.

@@ -124,7 +124,7 @@ <h1>Convert JS examples into Yaml</h1>
case 'boolean':
return object ? ' true' : ' false';
case 'string':
return " '" + object.replace(/'/g, "\\'") + "'";
return " '" + object.replace(/'/g, "''") + "'";
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary for the single-quoted style being used above?

$match:
x:
$gt: 0
$comment: 'Don''t allow negative inputs.'
Copy link
Member

Choose a reason for hiding this comment

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

Noted that this syntax is specific to Single-Quoted Style. Would it make more sense to use a Double-Quoted Style and avoid escaping altogether, or did you prefer single-quoted for consistency?

Copy link
Member Author

Choose a reason for hiding this comment

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

I use single quotes everywhere to avoid risky parsing.

@GromNaN GromNaN merged commit c0daa64 into mongodb:0.1 Jan 29, 2024
@GromNaN GromNaN deleted the PHPLIB-1341 branch January 29, 2024 09:46
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