MongoDB with Highcharts

Hi everyone,

I’m working with Highcharts and so far have only ever used Firebase as a storage solution for the data. I want to move over to MongoDB and I’m wondering how I would get the data in to my chart?

Thanks to @robfallows I have this code:

On the server side…

And the client…

So the Firebase data can be called in simply by adding the URL to the data followed by .json to get it into the correct format for Highcharts. How would I tweak this to use my MongoDB data? Is it just a case of adding the MongoDB connection string or is there more to it? Any help would be greatly appreciated. Below is a JSFiddle of the chart (Not working but just gives an idea of the code).

JSFiddle

Many thanks,

George

Getting MongoDB data to the chart is really easy in Meteor.

It may be that getting the data into MongoDB in the first place is harder! Are you thinking that you will get data from your Firebase endpoint(s) and insert into MongoDB (which is quite easy), or do you need to write a UI for users to create/edit data (harder - or at least, longer)?

The data simply needs to be inserted into MongoDB theres no need for the users to have any ability to edit or create the data - Just view it in chart form.

I’ve updated the GitHub repo I shared with you to use MongoDB and pub/sub. This is a pretty crude effort - it just takes your raw object and inserts it into MongoDB. Again, no effort to simplify the code or structure. Hope it helps.

1 Like

Exactly what I was after! Thanks very much!!

1 Like