Skip to content
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

MongoDB Support #138

Open
cordovapolymer opened this issue May 23, 2017 · 7 comments
Open

MongoDB Support #138

cordovapolymer opened this issue May 23, 2017 · 7 comments

Comments

@cordovapolymer
Copy link

Hi! Thanks for a great effort making php async!
Is mongodb supported? If so can you give an example of its usage?

@kelunik
Copy link
Member

kelunik commented May 24, 2017

I'm not aware of any implementation on Amp directly, but there's https://github.com/jmikola/react-mongodb which is based on ReactPHP and thus fully compatible with Amp v2. That package is marked as experimental, but maybe it helps.

@cordovapolymer
Copy link
Author

@kelunik , unfortunately it doesn't work with php7 and new mongodb php driver.

@bwoebi
Copy link
Member

bwoebi commented May 25, 2017

Hmm. Well, judging by the react-mongodb library, it should be pretty easy to write your own driver for this using amp.

If there is interest, I also may prototype such a basic library in a couple of hours.

@cordovapolymer
Copy link
Author

@bwoebi , please note that react-mongodb is based on a legacy php mongo extension for BSON processing which is not supported in PHP7, new mongodb extension is much sleeker, it provides BSON serialization and some low level features, but it lacks Asynchronous Queries support, there's a PHP library that is based on the new extension which implements all mongodb features.

What do you think about prototyping a basic amp driver which would be compatible with the mongo php library, so it could be used together in amp based apps?

@jmikola
Copy link

jmikola commented May 30, 2017

https://github.com/jmikola/react-mongodb is really just a proof of concept for executing basic queries and commands asynchronously. It only depends on the legacy extension for BSON encoding and decoding, but that could be trivially changed to use the new extension's functions and classes. I would not expect the PHP library to be usable atop any async PHP driver.

That said, it lacks many of the essential features you'd need in a driver. TLS connections, authentication,
server discovery and monitoring, and a usable API. An ideal API would probably be modeled after the Node.js driver or Motor (for Python).

As a side note, https://github.com/mongofill/mongofill implements the legacy driver's BSON API in pure PHP if you were looking to bootstrap a new async driver without any extension dependency.

@kelunik
Copy link
Member

kelunik commented Sep 3, 2017

Closing this issue, the possible options have been mentioned. Another option is to build a driver based on amphp/parallel.

@kelunik kelunik closed this as completed Sep 3, 2017
@kelunik kelunik changed the title is mongodb supported? MongoDB Support Nov 13, 2017
@kelunik kelunik reopened this Nov 13, 2017
@kelunik
Copy link
Member

kelunik commented Nov 13, 2017

Re-opening. Introduced the package request label for these kind of requests. I think amphp/amp is the best repository to collect these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants