mongoimport

Imports content from a JSON, CSV, or TSV file into a MongoDB database. More information: https://docs.mongodb.com/database-tools/mongoimport/.

mongoimport --file {{path/to/file.json}} --uri {{mongodb_uri}} {{[-c|--collection]}} {{collection_name}}

mongoimport --type {{csv}} --file {{path/to/file.csv}} {{[-d|--db]}} {{database_name}} {{[-c|--collection]}} {{collection_name}}

mongoimport --jsonArray --file {{path/to/file.json}}

mongoimport --file {{path/to/file.json}} --mode {{delete|merge|upsert}} --upsertFields "{{field1,field2,...}}"

mongoimport --type {{csv}} --file {{path/to/file.csv}} --fieldFile {{path/to/field_file.csv}} --ignoreBlanks

mongoimport --help