How to create relationships using realm?

Using the sample data provided by Atlas, can someone show me an example of how you would do the following using Realm?

-Using the sample_analytics collection create the following relationships

  1. One transaction is linked to one customer by saving the customer_id in it’s schema. I understand that the sample data is designed to link transactions to accounts however for my example i would prefer if both transactions and accounts are linked directly to the customer.
  2. One account is linked to one customer by saving the customer_id in it’s schema
  3. A customer returns an array of all the transactions that are linked to it
  4. A customer returns an array of all the accounts linked to it.

Following this example you would need to insert all account id’s in the customer accounts array and then would not be able to get the customer details from the accounts collection. How can you link an account to one customer to be able to get customer details, but then get all accounts related to a particular customer from the customer document?

Thanks :slight_smile: