Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Lock] Update the MongoDbStore to work with the latest version of the mongodb extension #36702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jakzal opened this issue May 5, 2020 · 4 comments

Comments

@jakzal
Copy link
Contributor

jakzal commented May 5, 2020

The MongoDbStore is not compatible with the latest versions of mongodb extension. The latest mongodb extension uses a new way of creating the client.

Instead of MongoDB\Client we now have MongoDB\Driver\Manager.

Some options to consider:

  1. Make the store work for both interfaces.
  2. Migrate the store to the new interface.
  3. Create a new MongoDbStore implementation for the latest version of the interface.
  4. Use an adapter: https://github.com/alcaeus/mongo-php-adapter.
  5. Drop mongodbstore.
@nicolas-grekas
Copy link
Member

  1. if possible :)

nicolas-grekas added a commit that referenced this issue May 5, 2020
…ranch (jakzal)

This PR was merged into the 5.1-dev branch.

Discussion
----------

Configure services additionally required by the master branch

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | Re #36647
| License       | MIT
| Doc PR        | -

Additionally run tests for:

* couchbase
* sqs
* kafka
* mongodb (although currently skipped due to #36702)

Before: Tests: 1893, Assertions: 5178, Skipped: 105.
After: Tests: 2042, Assertions: 5407, Skipped: 120.

Commits
-------

dc7ac57 Configure services additionally required by the master branch
@jakzal
Copy link
Contributor Author

jakzal commented May 6, 2020

BTW, looks like the old mongo extension doesn't even work with PHP 7, so there's no need to keep supporting it on the branches that only work with PHP 7.

EDIT: MongoDbStore is only available in 5.1

Not sure what happened there, but it was first merged into 4.3: #27648
Then again into 5.1: #31889

ping @kralos since you're the one that contributed this feature :)

@kralos
Copy link

kralos commented May 9, 2020

@jakzal I'm not sure what you mean by "not compatible with the latest versions of mongodb extension"? I use this store in production on php 7.4.4 with ext-mongodb 1.7.4 and mongodb/mongodb 1.6.0.

MongoDB\Client hasn't been replaced by MongoDB\Driver\Manager. They do different things at different layers.

MongoDB\Driver\Manager is the official latest PECL extension driver (aka ext-mongodb). see https://pecl.php.net/package/mongodb

MongoDB\Client is from the official latest PHP adapter (aka packagist mongodb/mongodb) that sits on top of the PECL driver. see https://github.com/mongodb/mongo-php-library

There was a legacy driver (ext-mongo). packagist package alcaeus/mongo-php-adapter is a compatibility layer exposing the ext-mongodb interfaces but using ext-mongo under the hood.

@jakzal
Copy link
Contributor Author

jakzal commented May 10, 2020

@kralos thanks for the clarification. One stackoverflow answer led me to believe the class is from the previous version of the extension. What I was missing is the mongodb/mongodb package though!

@jakzal jakzal closed this as completed May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants