mongoimport --db appdb --collection users --file users.json

Category: Databases & SQL

mongoimport --db appdb --collection users --file users.json

Import JSON documents into a collection

Loads the JSON file into the users collection, creating the collection if needed and inserting documents alongside existing ones. Use --drop to replace the collection first. The file format must match what mongoexport writes.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.