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.
-
@TravisT @jcaron Thank you guys! That is exactly what we decided to do. Connect to a webservice on the internet with wifi and make that communicate with the database.
-
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.
-
@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.
-
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
-
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?
-
A quick google search for "mongodb micropython" brought up this: https://github.com/nakagami/nmongo