Analyzing Stack Overflow Developers Survey Dataset With MongoDB Charts
MongoDB Charts is a great tool for analyzing and visualizing your datasets. Read on for quick run through of how to work with MongoDB Charts!
Join the DZone community and get the full member experience.Join For Free
Visualizations allow understanding and communicating your data to find patterns and trends within your datasets. MongoDB Charts is a visualization tool to create meaningful visualization of your MongoDB data.
Why MongoDB Charts?
The existing ways to visualize and analyze your MongoDB data is writing your own custom code to visualize data sitting in MongoDB or exporting MongoDB data to external ETL pipelines and visualize it using BI tools or use MongoDB connectors to export MongoDB data in BI tools and create visualizations. Using MongoDB charts allows you to take advantage of built-in aggregation frameworks and preserves the richness of your data using nested arrays and objects in your charts.
Setting Up Your Environment
This hands-on tutorial involves setting up working components to analyze Stack Overflow 2018 Developer Survey data using MongoDB charts:
- MongoDB Server (Running on your local machine, AWS EC2 or MongoDB Atlas): Guide
- MongoDB Charts Application (Runs inside a docker container): Guide
- Stack Overflow 2018 Developer Survey Dataset (Available on Kaggle public datasets).
- Import Stack Overflow 2018 Developer Survey Dataset to MongoDB server.
Upon completing the environment setup successfully, you should be able to connect a charts application to your browser on port 80. Log in using username and password created in Step 2.
Import Dataset to MongoDB
Import Stack Overflow 2018 Developer Survey Dataset to MongoDB server:
mongoimport --host `hostname` --port 27017 --db stackoverflow_survey --type csv --headerline survey_results_public.csv
Create Data Source in Charts:
The newly created data source will be listed in charts:
Create a Dashboard and Start Building Charts
Chart 1: Developer Demographics by Country
Choose the stackoverflow_survery data source from Data Source. From the Fields section, select Country key and drag the Country to Y-axis encoding channel. This determines which key to aggregate on.
Select _id from Fields section and drag it to the X-axis encoding channel.
Select AGGREGATED_VALUE on the Y-axis menu and sort descending from 9-1.
Apply appropriate filter to filer "NA" values from your result.
Chart 2: Commonly Used Communication Tools
Chart 3: Operating System Primarily Used by Developers
Add All the Charts to the Dashboard
This was a getting started guide with MongoDB Charts. Explore more powerful features of MongoDB charts and build dashboards for your data using this guide.
Opinions expressed by DZone contributors are their own.