MongoSluice Can Keep MongoDB and the RDBMS of Your Choice In Sync
The Goal: Sync Data Between MongoDB and RDBMS Via “Apply Deltas”
A convenient feature of MongoSluice is its ability to quickly sync changed or new data without doing any additional work such as investigating a schema or rewriting documents. MongoSluice does this with its applyDeltas parameter which can be found in the docs here.
For this demonstration, we are using a simple dataset with 200 documents called students. A link to the dataset can be found here. Here is a sample document from the collection:
“_id” : 1,
“name” : “Corliss Zuk”,
“scores” : [
“score” : 67.03077096065002,
“type” : “exam”
“score” : 6.301851677835235,
“type” : “quiz”
“score” : 66.28344683278382,
“type” : “homework”
After pushing students to MySQL once with MongoSluice, we updated one of the values of students in MongoDB. Here, you can see that we changed the value of the field “name” to “Jacob” in a students document.
Then we run MongoSluice again with the following command:
./mongosluice pushToSql –jobId 7 –mongoConnectionName testdatasets –sqlConnectionName testdatasets –mongoDBName testdatasets20181203 –mongoCollection students –applyDeltas true
Since the schema is not being investigated and the only change in MySQL is a single update, the job is finished very quickly. Here, the change can be noticed in MySQL:
In closing, MongoSluice is more than just a very effective tool for easily transferring data from MongoDB to RDBMS, it is also convenient for frequent use so that you are able to update your data multiple times a day in order to keep track of frequent changes.
MongoSluice is great at accurately Sluicing through complex data, but it is important to have a tool that is also built for speed. MongoSluice meets…read more
The Problem: How To Migrate MongoDB When A Field Has A Few Different Data Types. There are a couple tools out there that try to…read more
The Goal: MongoSluice’s power feature is that it can accurately convert data from MongoDB (BSON) to tables — rows and columns — without any…read more