Database/MongoDB
리눅스에서 몽고 DB 쿼리 실행하기 (mongosh)
2mukee
2024. 6. 26. 21:25
320x100
320x100
몽고 DB 쉘 실행
mongosh
데이터베이스 조회
show databases
데이터베이스 진입
use 데이터베이스
컬렉션 목록 조회 (테이블 목록 조회)
show collections
컬렉션 내 모든 아이템 조회 (상위 20개)
db.컬렉션.find()
컬렉션 내 특정 아이템 조회
db.컬렉션.find({ 키: 값 })
ex) db.Members.find({ID: 1234})
컬렉션 크기 조회
db.컬렉션.totalSize()
컬렉션 내 문서 개수 (테이블 내 행 수)
db.컬렉션.countDocuments()
컬렉션 인덱스 사이즈
db.컬렉션.totalIndexSize()
mongosh 공식문서
https://www.mongodb.com/docs/manual/reference/method/
mongosh Methods - MongoDB Manual v7.0
For details on a specific method, including syntax and examples, click on the link to the method's reference page.
www.mongodb.com
300x250
728x90