The blog has been added to the system. Now a user can add a comment. So next, we will see how to add a comment. As discussed, the Comment document type is defined as a nested type in the blog document. It means the blog document contains an array of comment objects, making a one-to-many relationship. We also need to create a comment model class as follows:
public class Comment { private String id; private String blogId; private String parentId; private int childSequence; private String position; private String status; private int level; private String user; private String emailAddress; private String commentText; @JsonFormat (shape = JsonFormat.Shape.STRING, pattern = "MM-dd-yyyy'T'HH:mm:ss") ...