Skip to content

PHPLIB-1715: Allow string to object conversion#1914

Merged
paulinevos merged 1 commit into
mongodb:v2.xfrom
paulinevos:toObject
Jun 8, 2026
Merged

PHPLIB-1715: Allow string to object conversion#1914
paulinevos merged 1 commit into
mongodb:v2.xfrom
paulinevos:toObject

Conversation

@paulinevos

Copy link
Copy Markdown
Contributor

Part of DRIVERS-3273

Copilot AI review requested due to automatic review settings June 2, 2026 13:55
@paulinevos paulinevos requested a review from a team as a code owner June 2, 2026 13:55
@paulinevos paulinevos requested a review from GromNaN June 2, 2026 13:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds builder support for the MongoDB aggregation $toObject expression operator (server feature noted as “New in MongoDB 8.3”), along with a fixture and test to validate pipeline rendering.

Changes:

  • Introduces ToObjectOperator and exposes it via Expression::toObject(...).
  • Adds a new pipeline JSON fixture for the “convert string to object” example.
  • Adds a PHPUnit test asserting the rendered pipeline matches the fixture.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

File Description
src/Builder/Expression/ToObjectOperator.php New auto-generated operator class for $toObject.
src/Builder/Expression/FactoryTrait.php Adds toObject() factory method to construct ToObjectOperator.
tests/Builder/Expression/Pipelines.php Adds JSON fixture for $toObject conversion example.
tests/Builder/Expression/ToObjectOperatorTest.php Adds coverage ensuring the builder emits the expected $toObject pipeline.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@paulinevos paulinevos merged commit da0f297 into mongodb:v2.x Jun 8, 2026
36 checks passed
@paulinevos paulinevos deleted the toObject branch June 8, 2026 10:50
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.

5 participants