Introduction

Using MongoDB you can simply import a JSON file and create a database, apply natural language processing techniques using NLTK in python and lastly visualise your sentiments using Power BI.You don’t need any special infrastructure, only need to install MongoDB, Power BI and the dataset of your choice.

Implementation

Run the Mmongod file from the bin folder. Import your json file into MongoDB as you usually do. You can import using cmd as shown below:

Log in to MongoDB and check if the new DB ‘Twitter’ and collection ’Tweets’ has been created:

Now let’s connect Power BI to MongoDB:

Download and install MongoDB BI Connector(monogdb-odbc-connector) from the link below, select the right version to install according to your machine and Power BI version:

 https://github.com/mongodb/mongo-odbc-driver/releases/

Now we need to run the mongodsql.exe file from the MongoDB connector bin folder to run the environment. This will launch the exe terminal.

Then need to add the MongoDB ODBC to our existing list of ODBC connections. For this you can simply look for ‘ODBC Data sources’ from the search option on the bottom left hand side as shown:

Add the MongoDB ODBC 1.0 Unicode Driver by clicking the ‘Add button’:

 

You can now see the MongoDB ODBC Data Source Configuration Use the server and port information from the mongodsql terminal as shown below:

No we are almost ready, Open Power BI. Click on ‘Get Data’ and scroll down to ODBC and select the data source we created in the previous  steps: