티스토리 뷰
728x90
Commonly used MongoDB commands
Database Management
- Create a database : use <database_name>
- Show the current database : db
- Show all databases : show dbs
- Drop a database : db.dropDatabase()
Collection Management
- Create a collection : db.createCollection("<collection_name>")
- Show all collections : show collections
- Drop a collection : db.<collection_name>.drop()
Document Management
- Insert a document :
db.<collection_name>.insertOne(<document>)
or
db.<collection_name>.insertMany(<documents>) - Find documents :
db.<collection_name>.find() or db.<collection_name>.findOne(<query>) - Update a document :
db.<collection_name>.updateOne(<query>, <update>)
or
db.<collection_name>.updateMany(<query>, <update>) - Delete a document :
db.<collection_name>.deleteOne(<query>)
or
db.<collection_name>.deleteMany(<query>)
Query Operators
- $eq : Matches values that are equal to a specified value.
- $ne : Matches values that are not equal to a specified value.
- $gt : Matches values that are greater than a specified value.
- $lt : Matches values that are less than a specified value.
- $gte : Matches values that are greater than or equal to a specified value.
- $lte : Matches values that are less than or equal to a specified value.
- $in : Matches any of the values specified in an array.
- $nin : Matches none of the values specified in an array.
- $and : Joins query clauses with a logical AND and returns all documents that match the conditions.
- $or : Joins query clauses with a logical OR and returns all documents that match the conditions.
The documentation provides comprehensive information on various topics, including installation, getting started, CRUD operations, aggregation, indexes, security, and more.
728x90
'Dev Story > MongoDB' 카테고리의 다른 글
Python을 활용한 MongoDB 인덱스 생성 방법: 빠른 검색과 쿼리 성능 최적화 (0) | 2023.04.11 |
---|---|
MongoDB 6.0에서 추가된 Time Series Collection 생성부터 조회까지 (1) | 2023.03.21 |
Step-by-step guide : How to Configure MongoDB Replica Set in Ubuntu (0) | 2023.03.15 |
Python MongoDB connect ( 연결하기 ) (0) | 2023.03.09 |
MongoDB Atlas 평생 무료로 사용해보기 (0) | 2023.03.08 |
댓글
250x250
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- AWS
- 실습
- 딥러닝
- 한식
- 따라하기
- ML
- 쉽게따라하기
- 티스토리
- frontend
- Docker 관리
- svelte 따라해보기
- MongoDB
- EC2
- typescript
- cloudcomputing
- docker
- python
- 개발이야기
- 클라우드
- Containerization
- AI
- GPT
- 따라해보기
- ChartGPT
- DevOps
- lambda
- nestjs
- ubuntu
- Redis
- svelte
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함