Skip to content

Instantly share code, notes, and snippets.

@MrMjauh
Created June 30, 2019 20:50
Show Gist options
  • Save MrMjauh/3a7827ce6860c6daa5db9772d43aed2e to your computer and use it in GitHub Desktop.
Save MrMjauh/3a7827ce6860c6daa5db9772d43aed2e to your computer and use it in GitHub Desktop.
Persitance classes conneted to mongodb
@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