Forrest logo
tool overview
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

  1. mongoexport is a command-line tool provided by MongoDB for exporting data from a MongoDB database.
  2. It allows users to extract MongoDB documents and collections in various formats, such as CSV, JSON, or even BSON.
  3. The tool comes bundled with the MongoDB installation, so there is no need for separate installation or setup.
  4. mongoexport supports a wide range of options and can be customized to export specific fields, limit the number of documents, or apply query filters.
  5. It can export data from a specific collection as well as entire databases.
  6. The exported data can be used for backup purposes, sharing with other users, or importing into another MongoDB instance.
  7. It can be used for both local MongoDB instances as well as remote databases by specifying the connection details.
  8. mongoexport can also output the exported data to stdout, which allows for seamless integration with other command-line tools or scripts.
  9. Users can specify the output file format, compression options, and field delimiter to suit their needs.
  10. 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 --help
    try on your machine
    explain this command
  • mongoexport:tldr:4329d mongoexport: Export a collection to `stdout`, formatted as JSON.
    $ mongoexport --uri=${connection_string} --collection=${collection_name}
    try on your machine
    explain 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 machine
    explain this command
  • mongoexport:tldr:5178f mongoexport: Export documents as a JSON array instead of one object per line.
    $ mongoexport --collection=${collection_name} --jsonArray
    try on your machine
    explain 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 machine
    explain 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 machine
    explain this command
  • mongoexport:tldr:e23ae mongoexport: Export documents to `stdout`, formatted as human-readable JSON.
    $ mongoexport --uri=${mongodb_uri} --collection=${collection_name} --pretty
    try on your machine
    explain this command
tool overview