코딩

mongo db 명령어

코딩쪼렙 2021. 12. 3. 18:05
728x90

1. 몽고 사용하기

> mongo

2. 내가 가진 db 보기

> show dbs

3. 현재 사용 중인 db 확인

> db

4. 사용할 db 선택하기

> use dbName
(현재 수업에서는 `use wetube`)

5. db 컬렉션 보기

> show collections

6. db 컬렉션 안에 documents 보기
>
 db.collectionName.find()
(현재 수업에서는 `db.videos.find()`)

7. db 컬렉션 안에 documents 모두 제거하기

> db.collectionName.remove({})
(현재 수업에서는 `db.videos.find({})`)