monga
monga copied to clipboard
will it compatible with new MongoDB library?
(The new MongoDB library is hosted here: https://github.com/mongodb/mongo-php-driver).
Would be great if a newer version of Monga would be compatible with it.
As far as I can see this codebase is pretty much dependant on old implementation of driver (type hinting).
One of possible solutions would be to use interfaces for hints, but since we're looking at driver dependency - this doesn't seem as a viable solution to me. Other possible approach could be to branch out and rewrite stuff for new driver.
In the meantime I've forked the project it and intend to rewrite it for new driver. However, I don't know how soon will I manage to do that, but I'll be more than happy to help out / merge it back in to monga, or give @thephpleague rights over the repo.
I've done some work on my fork, but there's so many things that have changed in drivers. Some of monga functionality will have to be dropped. Most notable changes are:
- new driver is returning objects by default (not arrays)
- Cursor no longer has timeout nor it can apply filters post-festum, and it can be iterated only once (eg: you can check count, but can't fetch results after count)
- there are some classes that simply don't exist or don't have pandans in new implementation of driver, eg
MongoDBRef
.
So, for my projects I've decided to drop monga and use native driver instead. I don't know when will I continue my work on porting Monga, or if I will ever complete it.
Sorry for the late response, as y'all may know, it gets a little crazy around this time of year for the folks in the states, amongst other places.
@shahmanthan9 @phofmann-trust Personally, I don't have any immediate plans to do this... but I can see myself following through with this within the next couple months here.
@kornrunner I appreciate you looking into it. Please keep us updated with anything you may find if you revisit things in the future. If your interest is revived, I can certainly create a new branch for you to target. Let me know.
@kornrunner I believe you can use the third connection parameter to tell the new driver to unserialize to arrays as default:
/* This example instructs the library to unserialize root and embedded BSON
* documents as PHP arrays, like the legacy driver (i.e. ext-mongo). */
$client = new MongoDB\Client(null, [], [
'typeMap' => ['root' => 'array', 'document' => 'array'],
);
@bcrowe however inconvenient it might be, we must use the new driver to operate with PHP7. Not sure about the compatibility of the current driver with MongoDB 3.0.
For me, the show stopper is that mongodb/mongodb doesn't have support for GridFS, but I guess the underlying driver must support it. In other case, then no one should move to the new driver yet.
@amenadiel I'm using the current (=old) driver with MongoDB 3.x. Works fine for me.
So what exactly is the status of this? All I get is a "MongoClient not found" error.
I'm on PHP 7.0.4
How to work with MongDB new driver
In one of my projects I successfully use https://github.com/alcaeus/mongo-php-adapter. Have not tried it together with league/monga though.
How can i use in monga...plz help me..i am using ur code...in my cakephp project plz update or suggest me how to do that...i will owe for u On 16 Mar 2017 8:55 pm, "Pascal Hofmann" [email protected] wrote:
In one of my projects I successfully use https://github.com/alcaeus/ mongo-php-adapter. Have not tried it together with league/monga though.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/thephpleague/monga/issues/36#issuecomment-287092964, or mute the thread https://github.com/notifications/unsubscribe-auth/AD5AOmnxjATFn4BkErF1a8ocmrvwdyHMks5rmVSFgaJpZM4G0hv0 .
Plz try with monga so will not impact on my existing project On 16 Mar 2017 10:13 pm, "basant kumar" [email protected] wrote:
How can i use in monga...plz help me..i am using ur code...in my cakephp project plz update or suggest me how to do that...i will owe for u On 16 Mar 2017 8:55 pm, "Pascal Hofmann" [email protected] wrote:
In one of my projects I successfully use https://github.com/alcaeus/mon go-php-adapter. Have not tried it together with league/monga though.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/thephpleague/monga/issues/36#issuecomment-287092964, or mute the thread https://github.com/notifications/unsubscribe-auth/AD5AOmnxjATFn4BkErF1a8ocmrvwdyHMks5rmVSFgaJpZM4G0hv0 .
Hey all. Sorry, I've been running in maintenance-mode as of recent, but seeing as more and more people really want to see this out the door -- I can try to get something out by the weekend.
@basantk As far as using this library in the context of Cake, you can either use this library directly, or trying writing your own datasource utilizing this library. https://github.com/cakephp/elastic-search is a good example of writing your own NoSQL-type datasource for Cake.
@bcrowe Any luck working on refactoring for the new MongoDB driver in PHP 7? Or is this something you think will never happen? I love using Monga and would like to adapt the REST framework I've developed over the last few years for use with PHP 7, but this is a blocker since I depend on Monga for interacting with MongoDB data sources.
@opengeek Yeah, I don't think this'll be happening any time soon (from my own efforts) as I've strayed away from Mongo a bit. Perhaps we can raise the signals to see if anyone is interested in adopting this and taking this on.
I'm looking for something new to start into...so I'll take a look into this and see if I can get it working with the new Mongo Client
This is what I did after getting
Fatal error: Uncaught Error: Class 'MongoClient' not found in /var/www/html/vendor/league/monga/src/League/Monga/Connection.php:54
Using the instructions using the alcaeus/mongo-php-adapter package:
composer config "platform.ext-mongo" "1.6.16" && composer require alcaeus/mongo-php-adapter
Now all seems to be working on PHP 7.2..Enjoy
@bcrowe close
Hi All,
I am facing the same issue:
Error: Class 'MongoClient' not found File F:\xampp5\htdocs\kosolverest\vendor\league\monga\src\League\Monga\Connection.php Line: 54
Below are my configuration: PHP 5.6 XAMPP Windows
I tried @angelxmoreno solutions, but I think it is only works for php 7. When I tried this solution, it is returning AuthenticationException.
Please help me in solving this issue.