MongoDB and GridFS are awesome, but I had to migrate some data to MySQL database. The biggest problem is that I used GridFS to store uploaded files. After unsuccessfully searching online I decided to write my own bash export script. How to export all the files out of mongodb gridfs? Here’s the script:
1 2 3 4 5 6 7 8 9 10
Script takes two parameters, first one is the hostname of the mongodb instance and the second is database.
For example: ./gridfs localhost scen will export all files from scen database on localhost to current directory, if you have directory structure in GridFS, it will create that directories too.