eolas/neuron/8e6dee36-9f5f-47c8-b9f6-5160559ef056/Importing_MongoDB_data.md

20 lines
492 B
Markdown
Raw Normal View History

2024-10-19 11:00:03 +01:00
---
tags:
- mongo-db
- node-js
- databases
---
# Importing data to MongoDB
We can use the command line to import data into a Mongo database. We can also
combine the importing of data with the creation of a database:
```bash
mongoimport --db [preexisting_or_new_database name] --collection [collection_name] --file sourcedata.json --jsonArray
```
We use `--jsonArray` to indicate the format of the data we are importing.
Once this has executed, the data will be visible in Compass.