{"id":16584,"date":"2024-02-19T08:08:31","date_gmt":"2024-02-19T08:08:31","guid":{"rendered":"http:\/\/www.withdata.com\/blog\/?p=16584"},"modified":"2025-10-13T09:09:21","modified_gmt":"2025-10-13T09:09:21","slug":"3-ways-to-export-mongodb-to-csv-tsv-json","status":"publish","type":"post","link":"https:\/\/www.withdata.com\/blog\/mongotofile\/3-ways-to-export-mongodb-to-csv-tsv-json.html","title":{"rendered":"3 ways to export MongoDB data to files (CSV, TSV, JSON) without coding"},"content":{"rendered":"<p>Sometimes, you need to export MongoDB data to files, CSV, JSON, or other types, here are some tools you can use.<\/p>\n<h2>1. mongoexport<\/h2>\n<p><a href=\"https:\/\/www.mongodb.com\/docs\/database-tools\/mongoexport\/\">https:\/\/www.mongodb.com\/docs\/database-tools\/mongoexport\/<\/a><\/p>\n<p>mongoexport is a command-line tool that produces a JSON or CSV export of data stored in a MongoDB instance.<\/p>\n<h3>MongoDB Export JSON<\/h3>\n<p>mongoexport &#8211;host=&#8221;mongodb0.example.com:27017&#8243; &#8211;collection=events &#8211;db=reporting &#8211;out=events.json<\/p>\n<h3>MongoDB Export CSV<\/h3>\n<p>mongoexport &#8211;db=users &#8211;collection=contacts &#8211;type=csv &#8211;fieldFile=fields.txt &#8211;out=\/opt\/backups\/contacts.csv<\/p>\n<h2>2. MongoDB Compass<\/h2>\n<p><a href=\"https:\/\/www.mongodb.com\/docs\/compass\/current\/\">https:\/\/www.mongodb.com\/docs\/compass\/current\/<\/a><\/p>\n<p>MongoDB Compass is a powerful GUI for querying, aggregating, and analyzing your MongoDB data in a visual environment.<br \/>\nYou can use MongoDB Compass to import and export data to and from collections. Compass supports import and export for both JSON and CSV files.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/mongotofile\/compass_export.png\" alt=\"MongoDB Compass Export\" width=\"693\" height=\"524\" style=\"max-width:100%;height:auto;display:block;\" \/><\/p>\n<p>for details: <a href=\"https:\/\/www.mongodb.com\/docs\/compass\/current\/import-export\/\">https:\/\/www.mongodb.com\/docs\/compass\/current\/import-export\/<\/a><\/p>\n<h2>3. WithData MongoToFile<\/h2>\n<p><a href=\"https:\/\/withdata.com\/mongo-to-file\/\">https:\/\/withdata.com\/mongo-to-file\/<\/a><\/p>\n<p>MongoToFile is a data conversion software that helps you to export MongoDB database data to CSV (TXT), SQL, JSON, XML, html, and Excel. Support all MongoDB deployment types: standalone, replica set, sharded cluster, and MongoDB Atlas.<\/p>\n<p>Support Windows, Linux, and macOS.<\/p>\n<p>Can run in GUI and CLI mode.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/withdata.com\/images\/mongotofile\/collection-to-file-target.png\" alt=\"MongoDB To CSV - set CSV\" width=\"722\" height=\"572\" style=\"max-width:100%;height:auto;display:block;\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/withdata.com\/images\/mongotofile\/collection-to-file-convert.png\" alt=\"MongoDB To CSV - export\" width=\"722\" height=\"572\" style=\"max-width:100%;height:auto;display:block;\" loading=\"lazy\" decoding=\"async\" \/><\/p>\n<p>For details:<\/p>\n<h3>MongoDB Export database to CSV files<\/h3>\n<p><a href=\"https:\/\/www.withdata.com\/tools\/mongodb-to-file\/mongodb-to-csv\">https:\/\/www.withdata.com\/tools\/mongodb-to-file\/mongodb-to-csv<\/a><\/p>\n<h3>MongoDB Export database to JSON files<\/h3>\n<p><a href=\"https:\/\/www.withdata.com\/tools\/mongodb-to-file\/mongodb-to-json\">https:\/\/www.withdata.com\/tools\/mongodb-to-file\/mongodb-to-json<\/a><\/p>\n<p>more:<br \/>\n<a href=\"https:\/\/www.withdata.com\/tools\/mongodb-to-file\/mongodb-to-tsv\">MongoDB export to TSV <\/a><br \/>\n<a href=\"https:\/\/www.withdata.com\/tools\/mongodb-to-file\/mongodb-to-excel\">MongoDB export to Excel<\/a><br \/>\n<a href=\"https:\/\/www.withdata.com\/tools\/mongodb-to-file\/mongodb-to-xml\">MongoDB export to XML<\/a><br \/>\n<a href=\"https:\/\/www.withdata.com\/tools\/mongodb-to-file\/mongodb-to-sql\">MongoDB export to SQL<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes, you need to export MongoDB data to files, CSV, JSON, or other types, here are some tools you can use. 1. mongoexport https:\/\/www.mongodb.com\/docs\/database-tools\/mongoexport\/ mongoexport is a command-line tool that produces a JSON or CSV export of data stored in a MongoDB instance. MongoDB Export JSON mongoexport &#8211;host=&#8221;mongodb0.example.com:27017&#8243; &#8211;collection=events &#8211;db=reporting &#8211;out=events.json MongoDB Export CSV mongoexport [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1687],"tags":[34,15,1418,1440,68],"class_list":["post-16584","post","type-post","status-publish","format-standard","hentry","category-mongotofile","tag-csv","tag-excel","tag-json","tag-mongodb","tag-xml"],"_links":{"self":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/16584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/comments?post=16584"}],"version-history":[{"count":10,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/16584\/revisions"}],"predecessor-version":[{"id":40181,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/16584\/revisions\/40181"}],"wp:attachment":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/media?parent=16584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/categories?post=16584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/tags?post=16584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}