Export JSON from RoboMongo

I use RoboMongo extensively for all my Mongo development work / debugging. I however sorely needed a way to export JSON from it. A Stack Over Flow link came up in a Google search and I was able to export JSON for my use. Basically you need to execute this command which uses “printjsononeline” function provided by Mongo to give you one line JSON for each row in the collection:

db.getCollection('collection_name').find({}).forEach(function(x){printjsononeline(x)});

Leave a Reply

Your email address will not be published. Required fields are marked *