Closed (fixed)
Project:
MongoDB
Version:
8.x-2.x-dev
Component:
Base module (driver)
Priority:
Minor
Category:
Task
Assigned:
Reporter:
Created:
3 Oct 2026 at 19:04 UTC
Updated:
18 Oct 2026 at 17:20 UTC
Jump to comment: Most recent
selectCollection() and selectDatabase() are deprecated in mongodb/mongodb.
The module still calls them in several places.
Not applicable, this is a deprecation cleanup.
Replace every call site with getCollection() and getDatabase(), which are
available in all supported library versions (^2.4 || ^1.21). No behaviour change,
these methods are direct equivalents.
None.
None.
None.
None.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
fgmHi Jérôme.
Thanks for the MR. The code changes are correct and complete, but I checked the latest driver version and neither method is currently deprecated, although both are now thin wrappers around their
get*counterparts. See e.g. https://github.com/mongodb/mongo-php-library/blob/v2.x/src/Client.php#L405 as of today : no deprecation mentionAFAICS that deprecation is only a future step, tracked at https://jira.mongodb.org/browse/PHPLIB-1553 so while the code is correct, the issue title is a bit ahead of reality, so I'm changing it for consistency before merging.
Comment #5
fgmMerged to today's HEAD, thanks. Regarding credits, you don't appear to have associated MongoDB to your work, although they're a long-ago sponsor of the project, so you can add them to the credits for your contributions if you wish.