<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Arthur Ribeiro on foojay.io - Friends of OpenJDK</title><link>https://foojayio.github.io/website/today/author/arthur_rib/</link><description>Articles written by Arthur Ribeiro on foojay.io - Friends of OpenJDK</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 26 Mar 2026 15:50:30 +0000</lastBuildDate><atom:link href="https://foojayio.github.io/website/today/author/arthur_rib/index.xml" rel="self" type="application/rss+xml"/><item><title>Modeling One-to-Many Relationships in Java with MongoDB</title><link>https://foojayio.github.io/website/today/modeling-one-to-many-relationships-in-java-with-mongodb/</link><pubDate>Thu, 26 Mar 2026 15:50:30 +0000</pubDate><guid>https://foojayio.github.io/website/today/modeling-one-to-many-relationships-in-java-with-mongodb/</guid><description>&lt;p&gt;In a relational database, modeling a one-to-many relationship is straightforward: you create two tables and connect them with a foreign key. When you need the data together, you write a JOIN. In MongoDB, you have a choice, and that choice has a direct impact on your application&amp;rsquo;s performance, scalability, and maintainability.&lt;/p&gt;
&lt;p&gt;Consider a common scenario: a BlogPost that has many Comment objects. In Java, this is a natural List&amp;lt;Comment&amp;gt; field on the post. But when it comes time to persist that relationship in MongoDB, you need to decide &lt;em&gt;how&lt;/em&gt; to store it. Should the comments live inside the blog post document? Or should they sit in their own collection, connected by references?&lt;/p&gt;</description></item></channel></rss>