How to export JSON from MongoDB using Robomongo

Undefined Variable picture Undefined Variable · Feb 26, 2015 · Viewed 171.7k times · Source

So I do not know much about MongoDB. I have RoboMongo using which I connect to a MongoDB. What I need to do is this - there is a collection in that MongoDB. I want to export the data from that collection so that I can save it into a file.

I used the interface to open the data from the collection as text and did a Ctrl + A and pasted into a text file. However, I found that not all data is copied and also that there were many comments in the text data which naturally breaks the JSON.

I am wondering if RoboMongo has a Export As JSON facility so that I can do a clean export.

Any pointers are appreciated!

Answer

öbl picture öbl · Aug 22, 2018

A Quick and dirty way: Just write your query as db.getCollection('collection').find({}).toArray() and right click Copy JSON. Paste the data in the editor of your choice.

enter image description here