![]() ![]() Read: MongoDB drop collection MongoDB export documents to CSV using python We successfully exported the documents of MongoDB into a CSV file using the atlas. In this example, we export all the documents present in the EmpInfo collection to a CSV file.Įxport MongoDB documents to CSV file using the atlas You will more understand with the help of an example so let’s get into it. With the help of this tool, we can export also in JSON format as well. In MongoDB, we use the mongoexport tool to “export MongoDB documents to CSV”. Export MongoDB documents to CSV with example So these are some of the options that you can use with the mongoexport tool and export the data into CSV file format or you can also export in JSON format as well. Specify the fields that include in the export.Ĭontrol from where mongoexport start exporting files. ![]() Specify the name of the database in which mongoexport will run There are some of the commonly used options in mongoexport: Option Read: How to download MongoDB database Tools? If mongoexport tool is not present in yuor system then install it from here.Here, the out command specifies the file in which exported data is to be stored and if we don’t use out then file will create at the path where we are at the time of running cmd.Note that, The mongoexport command does not run in the mongo shell so to run this command you have to exist from the mongo shell.įor export the data in CSV format mongoexport –db database_name –collection collection_name –type=csv –fields fields_names –out path_or_name_of_the_file With the help of this tool, you can export data of a collection in JSON or CSV format. So, to export the data from the MongoDB database, MongoDB provides a command-line tool known as mongoexport. ![]() We can also export data from MongoDB into other forms, such as JSON or CSV so that it can be used by other applications. MongoDB export to CSV with query (command)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |