HyuOniichan / Prj_WanderingWords

A blog website using MERN stack
0 stars 0 forks source link

[bug] Can't send Post method - Create function #13

Open HyuOniichan opened 20 hours ago

HyuOniichan commented 20 hours ago

Problem In #12 it can send request but the database is not updated image

Expected Send the data successfully

HyuOniichan commented 20 hours ago

Reason The problem is in the 'author' field It requires an ObjectId to refer to Author database

Fix Case 1 Get the ObjectId from current user

Case 2 Update the docs, add field 'username' which is unique (it's already in mongoose, but haven't updated in MongoDB atlas yet) Based on 'username', search for userId -> Not recommended because there may be an imposter