Articles → MONGODB → Mongoimport Utility
Mongoimport Utility
Purpose
Syntax
mongoimport --host [host] --port 27017 --db [database name] --collection [collection name] --file [json file] --jsonArray
Sample JSON
[
{"subject": "MongoDB Basics"},
{"subject": "Data Modeling in MongoDB"},
{"subject": "Indexing and Query Optimization"},
{"subject": "Aggregation Framework"},
{"subject": "MongoDB Atlas Overview"},
{"subject": "Replication and Sharding"}
]
Example
mongoimport --host localhost --port 27017 --db test --collection Articles --file C:/mongo/subject.json --jsonArray
Output