끄적끄적 메모2
const { user, password, content } = req.body;
if (!content) {...}
req.body 오는 Json 형태의 파일을 확인할때
content의 유무인가 확인하는게 아니다. 알고 썼어도 100% 아니라서 아차 싶을수 있다.
content가 empty string, undefined, null, NaN, or false 인지 확인하는거다.
전에도 언급했듯이 checkPost는 Promise resolved 오브젝이다.
const checkPost = await Post.findById({ _id: _postId });
toDoSchema.virtual("todoId").get(() => this._id.toHexString());
toDoSchema.virtual("todoId").get(function () {
return this._id.toHexString();
});
강의중 에러가 떳다. 이유는
In Mongoose, virtual getters and setters must use a regular function
declaration (function()), not an arrow function (() =>).
내가 좋아하는 THIS의 이유이다. 화살표 함수는...5시다 조금 쉬고 3시간후 수업때 일어나자
create() vs save()