Skip to content

Comments

Support version 2.0 of the MongoDB driver#2683

Merged
alcaeus merged 8 commits intodoctrine:2.11.xfrom
alcaeus:support-driver-2.0
Mar 22, 2025
Merged

Support version 2.0 of the MongoDB driver#2683
alcaeus merged 8 commits intodoctrine:2.11.xfrom
alcaeus:support-driver-2.0

Conversation

@alcaeus
Copy link
Member

@alcaeus alcaeus commented Oct 1, 2024

Q A
Type improvement
BC Break no
Fixed issues

Summary

The 2.0 release of the PHP driver will mainly remove deprecated functionality, which was already removed in a previous pull request. This PR adds a separate build job to test the ODM with version 2.0 of the extension and library to ensure everything continues to work. The goal is to support both versions of the extension at the same time to make upgrading easier.

@alcaeus alcaeus marked this pull request as draft October 1, 2024 11:37
@alcaeus alcaeus force-pushed the support-driver-2.0 branch from 3bc60e1 to 11c9306 Compare October 1, 2024 11:41
@alcaeus
Copy link
Member Author

alcaeus commented Oct 1, 2024

Note: static analysis will be red until we figure out how to best handle multiple driver versions in Psalm and PHPStan.

@alcaeus alcaeus force-pushed the support-driver-2.0 branch from 2d78bbb to f2ac6c4 Compare January 10, 2025 08:08
Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

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

Calls to selectDatabase and selectCollection should be replaced with getDatabase and getCollection.

@GromNaN GromNaN changed the base branch from 2.10.x to 2.11.x March 10, 2025 13:53
@alcaeus alcaeus force-pushed the support-driver-2.0 branch from 78e8a97 to 7d1e4ff Compare March 11, 2025 08:45
@alcaeus alcaeus force-pushed the support-driver-2.0 branch from 7d1e4ff to b04329c Compare March 21, 2025 09:00
@alcaeus
Copy link
Member Author

alcaeus commented Mar 21, 2025

Calls to selectDatabase and selectCollection should be replaced with getDatabase and getCollection.

Done, as well as requiring 1.21.0 as minimum version.

@alcaeus alcaeus changed the title WIP: Support version 2.0 of the MongoDB driver Support version 2.0 of the MongoDB driver Mar 21, 2025
@alcaeus alcaeus requested a review from GromNaN March 21, 2025 09:06
@alcaeus alcaeus marked this pull request as ready for review March 21, 2025 09:06
@alcaeus alcaeus force-pushed the support-driver-2.0 branch from 9dfbb60 to 2bc318d Compare March 21, 2025 09:14
$db = $this->createMock(Database::class);
$db->method('selectCollection')->willReturnCallback(fn (string $collection) => $this->documentCollections[$collection]);
$db->method('getCollection')->willReturnCallback(fn (string $collection) => $this->documentCollections[$collection]);
$db->method('selectGridFSBucket')->willReturnCallback(fn (array $options) => $this->documentBuckets[$options['bucketName']]);
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that we did not add getGridFSBucket in 1.21. My suggestion would be to add this method in 2.0 since the deprecation of the select methods will only happen later in the 2.x lifetime. WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Tracked in PHPLIB-1647

@GromNaN
Copy link
Member

GromNaN commented Mar 21, 2025

The bundle also needs to be updated: https://github.com/doctrine/DoctrineMongoDBBundle/blob/5.2.x/composer.json#L28

@alcaeus alcaeus merged commit 77b28b3 into doctrine:2.11.x Mar 22, 2025
20 checks passed
@alcaeus alcaeus deleted the support-driver-2.0 branch March 22, 2025 06:49
@GromNaN GromNaN added this to the 2.11.0 milestone Apr 8, 2025
@jorenvh
Copy link

jorenvh commented Apr 23, 2025

Currently the dev release is still being used, the official mongo library released a stable 2.0.0 release 2 weeks back. Can this be updated?

https://github.com/mongodb/mongo-php-library/releases/tag/2.0.0

@GromNaN
Copy link
Member

GromNaN commented Apr 23, 2025

Thanks for the reminder @jorenvh. Are you ready to start a pull request? You will need to replace stable with 1.21.0 and mongodb/mongo-php-driver@v2.x with stable.

@GromNaN
Copy link
Member

GromNaN commented Apr 23, 2025

I'll make the PR as it seems to be blocking the GitHub Actions for the branch 2.11

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.

3 participants