1. 기본 명령어
- Database 확인하기
> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
- database 생성
> use data2
switched to db data2
- collection 생성
> db.createCollection("stu")
{ "ok" : 1 }
- document 생성
> db.stu.insert( { name : "홍", age : 26, status:"A" } )
- document 확인
> db.stu.find()
- collection 확인
> show collections
- database 확인
> show dbs
- document 삭제 및 확인
> db.stu.remove({})
> db.stu.find()
- collection 삭제 및 확인
> db.stu.drop()
true
> show collections
- database 삭제 및 확인
> db.dropDatabase()
{ "dropped" : "data2", "ok" : 1 }
> show dbs
- 종료 명령
> exit
- 서버 종료
- 관리자 계정으로 변경후 명령어 입력, Ctrl+C도 가능
> use admin
switched to db admin
> db.shutdownServer()
2. NoSqlBooster 사용
- 다운로드 주소 : https://www.nosqlbooster.com/downloads
-> nosqlbooster4mongo-5.1.11.exe
'데이터사이언스 > MongoDb' 카테고리의 다른 글
4.mongoDB의 CRUD (0) | 2019.07.21 |
---|---|
2.MongoDB 설치 (0) | 2019.07.20 |
1.MongoDB 개요 (0) | 2019.07.20 |