Mongo db with Pycom GPy
-
Hello,
I'm trying to access mongo db with my GPy board. I have used PyMongo library before to access mongo db in my python scripts. But for that, I had installed PyMongo using pip install on my system. How can I achieve the same using GPy board? Pointers to any examples of pycom boards accessing dbs would also be helpful. -
A quick google search for "mongodb micropython" brought up this: https://github.com/nakagami/nmongo
-
Thanks for the pointer! I uploaded required files onto the board and tried running the example commands from the shell and got this error
AttributeError: 'module' object has no attribute 'connect'Tried to search online but seems like not many people have tried this out! Any tried and tested version of the same?
-
can you run the following and post back the output:
import nmongo print(dir(nmongo))It could be that the library did not upload correctly and hence doesnt work. It might be wirth connecting via FTP and checking the file contents are complete
-
@sprasad Not sure what your use case is, but in general it would probably be more appropriate for the GPy to call a webservice on a server, and have that server connect to the database, rather than trying to connect directly to the database from the GPy.
But of course YMMV.
-
I would agree with @jcaron. What would be easier is to communicate to some sort of backend, like Flask, that parses your data and stores it. A good example would be using a Flask server with MQTT and Mongo, then you can use MQTT from the Gpy to send data back and forth to the backend. This pulls a lot of the overhead on your resourced constrained Gpy.
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login