Guest User

Untitled

a guest
Jul 22nd, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. {
  2. "timestamp": "2018-07-22T17:06:20.111+0000",
  3. "status": 500,
  4. "error": "Internal Server Error",
  5. "message": "E11000 duplicate key error collection: newdb.user index: subscribedTo.username dup key: { : null }; nested exception is com.mongodb.MongoWriteException: E11000 duplicate key error collection: newdb.user index: subscribedTo.username dup key: { : null }",
  6. "path": "/user/add"
  7. }
  8.  
  9. @Document(collection = "user")
  10. @Data
  11. public class User{
  12.  
  13. @Id
  14. private String id;
  15.  
  16. @Indexed(unique = true)
  17. @NotBlank
  18. private String username;
  19.  
  20. @NotBlank
  21. @Size(min=5, max=32)
  22. private String password;
  23.  
  24. @Indexed(unique = true)
  25. @Email
  26. private String email;
  27.  
  28. @CreatedDate
  29. private Date dateRegistered;
  30.  
  31. @LastModifiedDate
  32. private Date dateLastEntry;
  33.  
  34. private String profilePictureUrl;
  35.  
  36. private List<User> subscribedTo;
  37.  
  38. private int active; //0 for false
  39.  
  40. public User(@NotBlank String username,
  41. @NotBlank @Size(min = 5, max = 32) String password,
  42. @Email String email,
  43. String profilePictureUrl) {
  44. this.id = UUID.randomUUID().toString();
  45. this.username = username;
  46. this.password = password;
  47. this.email = email;
  48. this.dateRegistered = new Date();
  49. this.dateLastEntry = new Date();
  50. this.profilePictureUrl = profilePictureUrl;
  51. this.subscribedTo = Arrays.asList();
  52. this.active = 1;
  53. }
  54. }
Add Comment
Please, Sign In to add comment