From 6a330e24512c214138e9e7e7b4c79a578313ff64 Mon Sep 17 00:00:00 2001 From: tactonbishop Date: Sat, 13 Aug 2022 09:30:04 +0100 Subject: [PATCH] Last Sync: 2022-08-13 09:30:04 --- Databases/MongoDB/Complete_example.md | 0 Databases/MongoDB/Create_database.md | 2 ++ Databases/MongoDB/Importing_data.md | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 Databases/MongoDB/Complete_example.md diff --git a/Databases/MongoDB/Complete_example.md b/Databases/MongoDB/Complete_example.md new file mode 100644 index 0000000..e69de29 diff --git a/Databases/MongoDB/Create_database.md b/Databases/MongoDB/Create_database.md index 61755e1..d1f4d24 100644 --- a/Databases/MongoDB/Create_database.md +++ b/Databases/MongoDB/Create_database.md @@ -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. \ No newline at end of file diff --git a/Databases/MongoDB/Importing_data.md b/Databases/MongoDB/Importing_data.md index e69de29..e3807b2 100644 --- a/Databases/MongoDB/Importing_data.md +++ b/Databases/MongoDB/Importing_data.md @@ -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.