mongo-php-library icon indicating copy to clipboard operation
mongo-php-library copied to clipboard

PHPLIB-1185: Add new methods to get database and collection instances

Open alcaeus opened this issue 1 year ago • 0 comments

PHPLIB-1185

This PR adds the following new methods:

  • Client::getDatabase, changed Client::selectDatabase and Client::__get to proxy to this method
  • Client::getCollection, changed Client::selectCollection to proxy to this method
  • Database::getCollection, changed Database::selectCollection and Database::__get to proxy to this method

Since they are widely used, I did not add any deprecation warnings, nor did I add any language to the documentation to indicate that they are deprecated. I left the tests as they are, as the old methods were changed to proxy to the new methods, so we are implicitly testing them. I can duplicate the existing tests, but I don't think this is necessary.

As a follow-up to this PR, we should update the documentation to use the new get(Database|Collection) methods, starting in 2.0 (as we only maintain a single documentation for 1.x, so users would have to figure out which method is correct for their version).

alcaeus avatar Oct 23 '24 09:10 alcaeus