Skip to content

Commit 2025b46

Browse files
committed
connect mongo docker and terminal
1 parent 0055034 commit 2025b46

File tree

5 files changed

+52
-1
lines changed

5 files changed

+52
-1
lines changed

mongoDB/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,6 @@ $RECYCLE.BIN/
8585
# Windows shortcuts
8686
*.lnk
8787

88-
# End of https://www.toptal.com/developers/gitignore/api/windows,linux,macos,database
88+
# End of https://www.toptal.com/developers/gitignore/api/windows,linux,macos,database
89+
90+
mongo_data/

mongoDB/docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: "3.9"
2+
3+
services:
4+
mongodb:
5+
image: mongo:5.0
6+
ports:
7+
- 27018:27017
8+
environment:
9+
- MONGO_INITDB_ROOT_USERNAME=root
10+
- MONGO_INITDB_ROOT_PASSWORD=root123
11+
volumes:
12+
- ./mongo_data:/data/db

mongoDB/src/02-docker/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Up mongodb
2+
3+
```sh
4+
docker-compose up -d mongodb
5+
```
6+
7+
## Check
8+
9+
```sh
10+
docker-compose ps
11+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
user("platzi_store")
2+
3+
db.products.find()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Conectar al container
2+
```sh
3+
docker-compose exec mongodb bash
4+
```
5+
6+
7+
## Connect with mongosh
8+
9+
```sh
10+
mongosh ""
11+
```
12+
13+
```sh
14+
show dbs
15+
16+
show collections
17+
```
18+
19+
```sh
20+
use("platzi_store")
21+
22+
db.products.find()
23+
```

0 commit comments

Comments
 (0)