eolas/zk/Create_Mongo_database.md

35 lines
706 B
Markdown
Raw Normal View History

2022-08-11 08:30:05 +01:00
---
2024-06-15 11:00:03 +01:00
tags:
- mongo-db
- node-js
- mongoose
- databases
2022-08-11 08:30:05 +01:00
---
# Creating a MongoDB database
First create a directory for the database and set permissions:
```bash
$ mkdir /data/db
$ sudo chown -R `id -un` /data/db
```
Then start the Mongo daemon
2022-08-16 11:58:34 +01:00
2022-08-11 08:30:05 +01:00
```bash
mongod
```
2022-08-16 11:58:34 +01:00
This will run continuously in the terminal and should say somewhere that it is
waiting for connections on port `27017`. This command must be executed before
you run any backend that interacts with the Mongo database.
2022-08-11 08:30:05 +01:00
## MongoDB Compass
_Compass_ is a graphical interface for viewing and interacting with the data in
your Mongo database. It will automatically load to the default Mongo port:
`27017`.
2022-08-11 08:30:05 +01:00
2024-02-16 16:14:01 +00:00
![](/img/mongo-compass.png)