Beginner : Storing sensor data in MongoDB

I am willing to store sensor data from my photon in a MongoDB local database for later visualisation and analysis.

Any idea how to do that ? Thanks !

If you’ve never done that before, it’ll take some time learning that. You’ll most likely want to use Node.JS to capture the information, and then send it to the database. From there, you’ll need something to display the information, for which you could use Angular.JS. Combine that with Express for the web stuff, and you’ve got yourself the so-called MEAN stack. Again, if you’ve never used any of those things, it’s going to have a learning curve to it. Luckily, everything is in JavaScript, so that’s only one language you’ll have to learn for the logic. For the web-side, you’ll have to do some HTML/CSS as well.
I’d advise you to start playing around with the MEAN stack as a whole, and try to get a feel for how it works. There’s a great package available for that, that makes setting it up a lot easier, and it has a demo as well. There’s also an amazing tutorial available that’ll help you familiarize with the whole thing, that I found really helpful. You can find that here. Work your way through those, and see if you understand most of it.
For visualization I like the highcharts library. It’s in JavaScript, and looks clean. Seems to provide most functionalities.
If you’ve got any specific questions, feel free to ask them, but teaching you how to setup the whole stack, and customize it, is a bit outside the scope of this community I think.

Best of luck!

2 Likes

As a web developer, I second the Highcharts suggestion. We don’t use AngularJS in our stack (we use Backbone/React) but NodeJS/Express is a great combo. Having JS end-to-end is really nice too. Definitely give that MEAN.JS a try, it’s a good way to take care of all the boilerplate stuff.

2 Likes

I am storing Temp and Humidity data to a Mongo DB database now.

I’m using Node Red to do this which is pretty cool but does have a steep learning curve to get going.

I followed this thread to get it going: Spark Core and Node-RED integration

Here is a good overview of Node Red https://www.youtube.com/watch?v=nHQl-Pb1Zvw

I signed up for IBM Bluemix and used the Node Red template they provide to get a hosed Node Red instance up and running on the net.

Most of what I did is in that first link posted above. I’m using Compose.io for my Mongo DB platform. But with IBM Bluemix there is a service called Mongo Labs which gives you a half gig of Mongo DB database storage room per month for free which I would recommend going with since Compose.io is costing me about $9 a month right now.

I can say its been rock solid so far and I’ve had it running for months now.

My plan is to also graph this data really nicely using Highcharts also but haven’t gotten there just yet.

Please share if you get this all up and running. :smile:

1 Like

Thanks for your answers ! I’ve been looking at the MEAN stack, it seems to be a really powerful tool :smile: .

Actually, I was thinking that I may don’t need all the web dev part since I only want to get the sensor data in a database so that I can perform some basic machine learning tasks with it. According to what @Moors7 said, I guess I just have to use Node.JS to capture the information, and then send it to the mongo database ?