On this page you find all important commands for the CLI tool mongoexport. If the
command you are looking for is missing please ask our AI.
mongoexport
- mongoexport is a command-line tool provided by MongoDB for exporting data from a MongoDB database.
- It allows users to extract MongoDB documents and collections in various formats, such as CSV, JSON, or even BSON.
- The tool comes bundled with the MongoDB installation, so there is no need for separate installation or setup.
- mongoexport supports a wide range of options and can be customized to export specific fields, limit the number of documents, or apply query filters.
- It can export data from a specific collection as well as entire databases.
- The exported data can be used for backup purposes, sharing with other users, or importing into another MongoDB instance.
- It can be used for both local MongoDB instances as well as remote databases by specifying the connection details.
- mongoexport can also output the exported data to stdout, which allows for seamless integration with other command-line tools or scripts.
- Users can specify the output file format, compression options, and field delimiter to suit their needs.
- Overall, mongoexport is a versatile and powerful tool for exporting MongoDB data, making it easier to work with data outside of MongoDB.
List of commands for mongoexport:
-
mongoexport:help mongoexport: Display help.$ mongoexport --helptry on your machineexplain this command
-
mongoexport:tldr:4329d mongoexport: Export a collection to `stdout`, formatted as JSON.$ mongoexport --uri=${connection_string} --collection=${collection_name}try on your machineexplain this command
-
mongoexport:tldr:4f3ae mongoexport: Export documents that match the query in the specified file to a CSV file, omitting the list of field names on the first line.$ mongoexport --collection=${collection_name} --type=${csv} --fields="${field1,field2,---}" --queryFile=${filename} --noHeaderLine --out=${filename-csv}try on your machineexplain this command
-
mongoexport:tldr:5178f mongoexport: Export documents as a JSON array instead of one object per line.$ mongoexport --collection=${collection_name} --jsonArraytry on your machineexplain this command
-
mongoexport:tldr:aacdc mongoexport: Export the documents in the specified collection that match a query to a JSON file.$ mongoexport --db=${database_name} --collection=${collection_name} --query="${query_object}" --out=${filename-json}try on your machineexplain this command
-
mongoexport:tldr:b0df1 mongoexport: Export documents to a CSV file.$ mongoexport --collection=${collection_name} --type=${csv} --fields="${field1,field2,---}" --out=${filename-csv}try on your machineexplain this command
-
mongoexport:tldr:e23ae mongoexport: Export documents to `stdout`, formatted as human-readable JSON.$ mongoexport --uri=${mongodb_uri} --collection=${collection_name} --prettytry on your machineexplain this command