CmdID

CmdID / Commands

mongoimport

Import content from a JSON, CSV, or TSV file into a MongoDB database. tldr-pages

On several platforms

Opens CmdID with your command. It is read in your browser and sent nowhere.

Several platforms

from tldr-pages, CC BY 4.0

Import a JSON file into a specific collection

mongoimport --file path/to/file.json --uri mongodb_uri --collection collection_nameIdentify

Import a CSV file, using the first line of the file to determine field names

mongoimport --type csv --file path/to/file.csv --db database_name --collection collection_nameIdentify

Import a JSON array, using each element as a separate document

mongoimport --jsonArray --file path/to/file.jsonIdentify

Import a JSON file using a specific mode and a query to match existing documents

mongoimport --file path/to/file.json --mode delete --upsertFields "field1,field2,..."Identify

Import a CSV file, reading field names from a separate CSV file and ignoring fields with empty values

mongoimport --type csv --file path/to/file.csv --fieldFile path/to/field_file.csv --ignoreBlanksIdentify

Display help

mongoimport --helpIdentify