Last Sync: 2022-08-13 09:30:04

This commit is contained in:
tactonbishop 2022-08-13 09:30:04 +01:00
parent fdb3739410
commit 6a330e2451
3 changed files with 20 additions and 0 deletions

View file

View file

@ -49,3 +49,5 @@ sudo systemctl start --now mongodb
# Remove the current socket
rm /tmp/mongodb-27017.sock
```
For additional command line utilities you will also need to install `mongodb-tools` from the AUR.

View file

@ -0,0 +1,18 @@
---
tags:
- Databases
- mongo_db
- node-js
---
# 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.