Created
June 30, 2019 20:50
-
-
Save MrMjauh/3a7827ce6860c6daa5db9772d43aed2e to your computer and use it in GitHub Desktop.
Persitance classes conneted to mongodb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Data | |
@NoArgsConstructor | |
@Document(collection = "user") | |
public class User extends BaseEntity { | |
@Field("email") | |
@Indexed(unique = true) | |
private String email; | |
@Field("token") | |
@Indexed(unique = true) | |
private String token; | |
@Field("roles") | |
private HashSet<String> roles; | |
} | |
@Data | |
public class BaseEntity { | |
@BsonId | |
private ObjectId id; | |
@Field("updated_at") | |
@LastModifiedDate | |
private Date updatedAt; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment