title: Nested Objects in Realm React-Native
body: <p><strong>Question</strong></p>
  
  <p>How does Realm React Native perform with two way linking in parent-child nested relationships?</p>
  
  <p><strong>Example</strong></p>
  
  <p>I have an Invoice object, which is made up of InvoiceLines. In the old database, each row in the InvoiceLine table had a reference to its parent Invoice's ID. So a simple 'WHERE ID= " query to get from either an InvoiceLine to its Invoice or an Invoice to all of its InvoiceLines.</p>
  
  <p>In Realm, I'm going to have the following schema (paraphrased):</p>
  
  <pre><code>class Invoice {};
  Invoice.schema = {
    name: 'Invoice',
    properties: {
      ...
      lines: {type: 'list', objectType: 'InvoiceLine'}
    }
  }
  
  class InvoiceLine {};
  InvoiceLine.schema = {
    name: 'InvoiceLine',
    properties: {
      ...
      invoice: 'Invoice',
    }
  }
  </code></pre>
  
  <p>How does the performance of this direct linking compare with using ID's and doing it the traditional way within Realm? Is there a memory tradeoff to store all of those links?</p>