fullstack-hy2020 / fullstack-hy2020.github.io

https://fullstack-hy2020.github.io
Other
1.48k stars 3.69k forks source link

Update part4d.md #3674

Closed AhmedLebda closed 1 month ago

AhmedLebda commented 1 month ago

The user returned after db query await user.findOne({username} shouldn't return _id because we used the json method on user schema to return id instead of _id, so all lines that used user._id are updated to user.id

AhmedLebda commented 1 month ago

await user.findOne({username} returns a query object which in fact contains _id it will only return id if we invoked the .toJSON() method on it

sorry for my mistake.