title: MongoDB One-to-Many and Many-to-One relations in Spring Boot Project
body: <p>please how can I add relations in a mongoDB cause I just start using it. For example <strong>Comment id is a foreign key</strong>:</p>
  
  <pre><code> @Document
      class Comment {
  
          @Id
          private String id;
          private String text;
          private String author;
  
          // constructors, getters and setters are ommited
      }
  
      @Document
      class Article {
          @Id
          private String id;
          @DBRef(lazy = true)
          @CascadeSave
          private List&lt;Comment&gt; comments;
          private String title;
          private String text;
  
          // constructors, getters and setters are ommited
      }
  </code></pre>