doctrine/mongodb

Support for ext-mongodb

Closed this issue · 15 comments

Are there any plans to support the new ext-mongodb extension? The deprecated ext-mongo doesn't support PHP 7.

RonXS commented

I was able to work around this problem by forking the doctrine repositories and updating the requirement to mongodb 1.1 instead of mongo

My forks as an example:

https://github.com/Wizkunde/mongodb.git
https://github.com/Wizkunde/mongodb-odm.git
https://github.com/Wizkunde/DoctrineMongoDBBundle.git

So the API is of mongo and mongodb is exactly the same?

RonXS commented

I'm currently testing if there are any issues with it, it installs properly. My application also runs properly. Saving to mongo and querying to mongo is something that i'm going to test next.

I don't expect a lot of problems with it to be honest. But ill keep you posted.

updating the requirement to mongodb 1.1 instead of mongo

Was that a typo? Your repositories have the ext-mongodb dependency as ">=1.0". 1.1 has yet to be released.

The ext-mongo and ext-mongodb APIs are not at all similar. My assumption is that you've simply changed the Composer requirement, which affects platform checks, both extensions are still loaded by PHP, and Doctrine is still using the original extension.

So doctrine/mongodb does need to be updated in order to work with PHP 7, right?

RonXS commented

Yes, i tested it and definitely there are issues. MongoDB is installed, but the API of mongodb is actually quite different. Therefor we're stuck at php 5.* until the doctrine maintainers update the latest version to a 7.0 compatible version. (One of the issues that i immediatly run into is that it's looking for old classes like MongoId that are no longer there)

(For the record, i've verified that mongodb is installed and enabled, (output from phpinfo):

mongodb version 1.0.0alpha3

Oh, okay, got it: ext-mongo is being replaced by mongodb/mongodb, which is an abstraction for ext-mongodb written in PHP. So I guess this package need to be updated to depend on mongodb/mongodb, which has an API similar to ext-mongo.

@jmikola, I just saw that you're actually a maintainer at mongodb. Can you give us some insight into the whole thing? This keeps me from upgrading some of my projects to PHP 7.

I'm not @jmikola, but here goes:

We haven't yet decided exactly on how we'll handle the migration to PHP 7 and ext-mongodb other than "it will happen".

That clears thing up. Thanks!

👍

ChubV commented

Any news or plans on this issue?

pilou commented

+1 on ext-mongodb support

amcsi commented

+1

I'm locking this for "+1" defense. We will post an update once there is something to know.

So, after quite some time and with the upcoming release of doctrine/mongodb 1.4 I think there is some more information to be told.

First of all, this library won't be adapted to work with the new MongoDB driver. Most of the functionality is well covered by mongodb/mongodb. Any functionality we'll find missing while migrating ODM to the new driver might be either added to ODM itself, a new package or (most preferably) to mongodb/mongodb.

As for PHP 7 support, you can run ODM (or this library for that matter) on PHP 7 by using alcaeus/mongo-php-adapter. That library provides the legacy driver API on top of the new MongoDB driver and serves as an interims package until we have ported ODM to use the new driver natively. Once that is complete, we will release ODM 2.0 with full support for the new driver.