Cannot resolve "User Management: duplicate emails should not be allowed"

While working trough the M220J course, I’m facing issues with resolving the ticket on user management (chapter 2). All the unit tests pass (mvn test -Dtest=UserTest), however, when I try to fetch answer code from http://localhost:5000/status I get the error “User Management: duplicate emails should not be allowed”. In another topic I read about the upsert instead of the insert, so I implemented accordingly. Unfortunate it doesn’t solve the error in the status page. I checked my collections in Mongo too, but I don’t see duplicate emails being created. Could you help with providing a suggestion on how to improve my code to resolve the error on the status page?

Welcome to the community Woutske,
The original code handles duplicate emails.
Make sure you haven’t changed :

  • addUser(User user) in UserDao.java
  • UserService.java
  • UserController.java
1 Like

Thanks for your quick response! It sounds like I have been to enthusiastic :grimacing: I’ll check and will let you know.

You’re right, I indeed update the addUser(User user) in UserDao.java. I reverted that back and the above mentioned error is gone. Unfortunate I’m running in a new error (User Management: invalid response to login). Thanks for your help so far!

1 Like

Pleasure,

Marking this issue as Solved will be appreciated

Check this solution. If the problem persists, open a new topic and provide the console log

Good luck

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.