mongoimport

Imports content from a JSON, CSV, or TSV file into…

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}} --collection={{collection_name}}

mongoimport --type={{csv}} --file={{path/to/file.csv}} --db={{database_name}} --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

Также может быть вам интересно:
КодТрюки BashНастройкиТерминал/Консоль
← mongoexport mongorestore →