강의

멘토링

커뮤니티

Inflearn Community Q&A

kylesong273566's profile image
kylesong273566

asked

Node and React series that you can learn by following - Basic lecture

Node React Basics Lecture #10 Encrypting Passwords with Bcrypt

this 대신 todoSchema 사용 시 에러 이유

Written on

·

193

0

안녕하세요,

제가 let user = this;  를 대신해서

위를 모두 가리키는 todoSchema 을 사용하였습니다.

todoSchema.isModified('password'))
todoSchema.password
todoSchema.password
postman 에서 post send 시 에러나와서요.ㅠ
혹시 제가 잘 못 사용했는지요? 아니면 다르게 사용해야 하나요?
reactnodejs

Answer 2

1

John Ahn님의 프로필 이미지
John Ahn
Instructor

this들어 있는 값은    user의 정보들이 들어있습니다   하지만  todoSchema를  console.log로 찍어보시면 

훨씬 많은 정보들이 들어있고   this와는 다른 형식으로 들어있답니다. 

그러기에  this를 쓰셔야지   this.password 이런식으로 접근이 가능합니다 ^^ 

0

kylesong273566님의 프로필 이미지
kylesong273566
Questioner

감사합니다! 이 부분 this에 대해서 조금 더 자세히 알고 싶은데 참고할 만한 주소가 있을까요??

kylesong273566's profile image
kylesong273566

asked

Ask a question