gothinkster / gothinkster/node-express-realworld-example-app
Error "_id is already taken" when trying to update user....
- Dominant language
- TypeScript
- Stars
- 3.8k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
I tried the POSTMAN api to update the user's email address via the PUT request but I get the following error
saying the _id already exists:
=====================================
{
"errors": {
"_id": "is already taken"
}
}
=====================================
I believe the error is being triggered by the uniqueValidator(). I read on stackoverflow that if one uses
findOneAndUpdate() instead then the uniqueValidator is not invoked. However when I tried this I got an
error that one cannot modify the _id of an existing entry in the database (even though the _id is the same
value as before).
Anybody else encounter this error? Please advise.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.