While working with MongoDB you’ll often run into situations where you need to get data out of your server. MongoVUE has some built-in exporting capabilities that make it fairly simple to fetch data in CSV and Microsoft Excel formats. Let’s explore this feature in detail.

Data can be exported from “View” and “Find” options through the “Refresh" dropdown and “More” dropdown respectively, as displayed below.

Exporting MongoDB data through View option

Exporting MongoDB data through Find option

 

Upon clicking the Export menu, you’ll get a popup window as shown below. The combo-box at the top allows you to select the format in which you want to export the data. Currently following 3 formats are available:

  • CSV or Comma Separated Values
  • TSV or Tab Separated Values
  • MS Excel format

Export Documents from MongoDB

Each format displays a number of settings (fairly obvious) that allow you to fine-tune the data exported. Majority of times, these setting should work as is, without any modifications.

 

Now lets get to the last step – MongoVUE gives you 3 buttons for exporting your data.

  • Clipboard: When you click on this button, the selected data is copied to clipboard. You can now go to a suitable application and “Paste”/Ctrl+V to get this data.
  • Instance: Launches the notepad (or the correct application) and with the selected data in it.
  • File: Opens a “File Save As” dialog, allowing you to save the selected data to a file on your disk.

 

Please note that support for other export formats (like Json and Xml) are on the roadmap and will be added in future.

Tags: , ,

7 Responses to “Exporting data from MongoDB”

  1. Sampsa February 21, 2011 at 7:27 pm #

    I’m trying to export data to Excel, and it works nicely, except the export cannot handle embedded documents and will see them as “Array”.

    Any way around this, or should I rebuild how I insert data?

    • ishaan February 22, 2011 at 10:22 am #

      Hi Sampsa,
      Hierarchical model (as in MongoDB) does not directly translate to a relational model (as in Excel). Hence MongoVUE just displays “Array”. There is no way around this presently. But if you can send me your thoughts on how this should work (at mongoVue@gmail.com), then it can be incorporated in a future release of MongoVUE.
      - Ishaan

      • Rishi March 14, 2012 at 5:19 am #

        Just create a comma separated string representation of array and print it instead of “Array”

  2. Patric March 1, 2011 at 9:14 pm #

    Hi, when building a table view using Find to return a subset of fields, is there any way to specify the order in which these appear (columns from left to right)?
    Thanks!

    • ishaan March 7, 2011 at 1:48 pm #

      Hi Patric,
      There is no such provision in MongoDB to specify the order of keys withing a matching document (Note: Sort Order is different). MongoVUE creates columns in the order that it encounters these fields inside documents. So you cannot change this. If this is a feature you’d really like, let me know. Just send me an email as mongovue@gmail.com, with your usecase.
      - Ishaan

  3. mthompson June 25, 2011 at 10:08 pm #

    This question is relative to copying collections (data) from one server (or to the same server). Is there a way to specify criteria as to what to copy, i.e. a selected date range? This feature would be great!

    • ishaan June 26, 2011 at 1:06 pm #

      @mthompson, So you want to copy the results of a query (FindView) to a collection. Added your request to the task list! – Ishaan