MongoDB Import and Export

420 views
Skip to first unread message

Turk McGill

unread,
May 4, 2016, 12:05:17 PM5/4/16
to mongodb-user
I deleted my old post and I'm trying again -- without all the irrelevant stuff this time...

I'm looking for a way to integrate Excel and MongoDB.  Specifically, I'd like to read a MongoDB database and display some of the data in spreadsheet form.  Then I want to make changes to the spreadsheet and update MongoDB.

What would be the best way for me to do this, as a person with very weak programming skills?

My best option right now is to do the following:

1.  Run MongoChef and connect to our database
2.  Export a collection to a .json file
3.  Use Excel VBA code to parse the .json file into a spreadsheet
4.  Make changes to the data on the spreadsheet
5.  Save the spreadsheet as a .json file
6.  Use MongoChef to Import the .json file into the database

I can make all of that work, but it's obviously NOT ideal.  Any other suggestions?

-- John

Chris Cunningham

unread,
May 10, 2016, 2:53:14 AM5/10/16
to mongodb-user

John,


Your procedure of extracting the collection into a .json file and then bringing it into Excel for editing and then back out as a .json file and importing that file back into MongoDB may be the most direct solution to your problem, given your situation.


Please note that although your method is currently workable, there is an important caveat to be aware of: datatypes are not preserved across the export-modify-import process. 


Due to MongoDB's flexible schema, this may or may not be acceptable for your use case. Please see Data Modeling and BSON Types for more information regarding this topic.


However, there are several 3rd party applications and User Interface utilities that you may find useful that could be easier than your current process. These can be found at MongoDB Tools.


Additionally, you may find the following links helpful:

▪ if you are familiar with Javascript, you can write scripts for the mongo shell (https://docs.mongodb.com/manual/tutorial/write-scripts-for-the-mongo-shell/)
▪ there are drivers available for many languages, both officially supported (https://docs.mongodb.com/ecosystem/drivers/) and community supported (https://docs.mongodb.com/ecosystem/drivers/community-supported-drivers/).
▪ If you are familiar with any of the supported languages, there should be a relatively low barrier of entry to using MongoDB with those languages
▪ Free training sessions at 
MongoDB University are coming up on May 24th. It is a free course, which will be useful if you are interested in using MongoDB


Regards,


Chris

Reply all
Reply to author
Forward
Message has been deleted
0 new messages