| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- springboot
- MongoDB
- Jenkins
- React
- MUI
- javascript
- ngrok
- 500
- Express
- linux
- EC2
- github
- fastapi
- error
- AWS
- js
- docker
- deploy
- Troubleshooting
- AWS EC2
- python
- webhook
- axios
- nodejs
- TypeScript
- Github Actions
- Spring
- macbook
- Java
- RDS
- Today
- Total
목록MongoDB (2)
BEAT A SHOTGUN
시작질문과 답변을 등록하는 데에 다양한 방법이 있지만,가끔여러 이유로 답변 데이터를 생성하면서 답변 데이터에 질문id를 포함하고, 동시에 질문 데이터에 답변id도 추가하도록 하고 싶을 때가 있다.그래서insert_answer_result = await mongodb.answer.insert_one({ "question_id": question_id, **answer_data ... })update_question_result = await mongodb.question.update_on( {"question_id": question_id}, {"$addToSet": {"answers": answer_id}})이렇게 할 때가 ..
매우 간단한 CRUD 만들기를 해볼거다. FastAPI, 데이터베이스로는 MongoDB 와 연결해볼거다. MongoDB 와 연결을 위해서는 Odmantic 이라는 중간다리 ODM 이 필요하다. mysql 같은 RDB 였다면 mybatis 같은 ORM 이 필요했겠지? python 에서도 mybatis 쓰나? 모르겠다 아무튼 odmantic 이 그런 역할이라 사용할거다. 먼저 pip install odmantic 을 이용해 설치해주자. 매우 쉽지만, 매우 고된 과정이었다. 영어를 못해서. 참고 motor AsyncioMotorClient odmantic pymongo API Docs pymongo readthedocs stackoverflow MongoDB Docs MongoDB 기초 - 블로그 그래서 정리..