Withdata Software

3 ways to import data from files (CSV, TSV, JSON) into MongoDB without coding

Sometimes, you need to import data from files, CSV, JSON, or other types, to MongoDB collections, here are some tools you can use. All supports Atlas.

1. mongoimport

https://www.mongodb.com/docs/database-tools/mongoimport/

mongoimport is a powerful command-line tool for importing data from JSON, CSV, and TSV files into MongoDB collections.

MongoDB Import JSON

mongoimport --host=mongodb1.example.net --port=37017 --username=user --collection=contacts --db=marketing --file=/opt/backups/mdb1-examplenet.json

MongoDB Import CSV,TSV

mongoimport --db=users --collection=contacts --type=csv --headerline --file=/opt/backups/contacts.csv

2. MongoDB Compass

https://www.mongodb.com/docs/compass/current/

MongoDB Compass is a powerful GUI for querying, aggregating, and analyzing your MongoDB data in a visual environment.
You can use MongoDB Compass to import and export data to and from collections. Compass supports import and export for both JSON and CSV files.

for details: https://www.mongodb.com/docs/compass/current/import-export/

3. WithData FileToMongo

https://withdata.com/file-to-mongo/

FileToMongo is a data conversion software that helps you to import File (TXT, CSV, TSV, EXCEL, JSON, XML, SQL, INI, RDF, LOG) data to MongoDB. Support all MongoDB deployment types: standalone, replica set, sharded cluster, and MongoDB Atlas.

For details:

Import CSV file to MongoDB collection

http://www.withdata.com/blog/filetomongo/import-csv-file-to-mongodb-collection.html

Import JSON file to MongoDB collection

http://www.withdata.com/blog/filetomongo/import-json-file-to-mongodb-collection.html

more:
TSV to MongoDB
Excel to MongoDB
XML to MongoDB
SQL to MongoDB
TXT (“|” pipe delimited text) to MongoDB
TXT (“;” semicolon delimited text) to MongoDB