250x250
Notice
Recent Posts
Recent Comments
- Today
- Total
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- moment
- til
- clipBehavior
- async
- certbot
- Express
- mongoose
- Find
- atlas
- jsonwebtoken
- single quote
- flutter
- css
- double quote
- mongodb
- sequelize
- Node.js
- nginx
- EC2
- wil
- RDS
- findByIdAndDelete
- TypeScript
- TailwindCSS
- await
- Nodejs
- MYSQL
- JavaScript
- AWS
- https
Link
Archives
반응형
목록findByIdAndUpdate (1)
기억 휘발 방지소
[Node.js / mongoose] findByIdAndUpdate로 수정을 해보자
📌 findByIdAndUpdate를 쓰지 않고 수정하기 title과 description을 수정할거다. findById()로 DB에서 문서들을 가져오고 post.title = title; post.description = description; 으로 수정하려고하는 값들을 바꿔주고 post.save()를 해준다. export const postEdit = async (req, res) => { const { id } = req.params; const { title, description } = req.body; const post = await Post.findById(id); // 수정 post.title = title; post.description = description; await post.s..
Database/ODM
2021. 9. 21. 16:19
반응형