You are here:
< Back

Introduction

Before troubleshooting your own data, it is highly recommended to try a test dataset first.  This article is written for you to practice getting comfortable using MongoSluice.  This article assume a prerequisite of first having read the Get Started guide and we are using Linux.

Importing the Dataset into MongoDB

Download video_movieDetails.bson.  Your file should look like video_movieDetails.bson.gz.  Copy this file over to the desired route with an existing instance of MongoDB with scp or download it directly with wget -O video_movieDetails.bson.gz https://mongosluice.com/wp-content/uploads/2018/12/video_movieDetails.bson_.gz.   Unzip this file by typing gunzip video_movieDetails.bson.gz in the terminal.  Make sure that you have an instance of Mongod running.  Then from the terminal (not the mongo shell), type mongorestore –db testdataset –collection moviedetails video_movieDetails.bson.  You should get a message that looks like this:

Editing Conf Files

In the mongosluice directory of your MongoSluice machine, edit nano conf/mongoconnections.json to include “testdataset”:{“server”:”<ipaddress>”,”port”:27017} where IP is the IP of the MongoDB machine and port is the default MongoDB port.  Then edit nano conf/sqlconnections.json to include “testdataset”:{“dbConnection”:”jdbc:mysql://<ipaddress>/moviedetails?user=dev”} where IP is the IP of the MySQL machine and moviedetails is the database that we are connecting to.

Create Database in MySQL

Using a MySQL client on the desired database, type create database moviedetails;  This will create the target database.

Running MongoSluice

Back on the MongoSluice machine, change directory to mongosluice/bin.  Type ./mongosluice pushToSql –jobId 1 –mongoConnectionName testdataset –sqlConnectionName testdataset –mongoDBName testdataset –mongoCollection moviedetails –applyRelationalIntegrity true and let it run for a few moments.

Success

If you have followed the steps correctly, you should have a successfully populated database within MySQL with multiple tables and relationships.  You should also see a file in the bin folder named jsonGraph_1.json which contains the moviedetails schema.  You are now ready to take on big datasets.