title: How to determine an inverse relationship of a to-one relationship using Realm?
body: <p>Is it possible in Realm to obtain the inverse relation of a to-one relationship?</p>
  
  <p>For example:</p>
  
  <pre><code>    class Dog: Object {
          dynamic var name: String?
          dynamic var owner: Person?
      }
  
      class Person: Object {
          dynamic var name: String?
          let dog = LinkingObjects(fromType: Dog.self, property: "owner").first
      }
  
  
  
      let person = Person()
      person.name = "Harry"
      try! realm.write {
          realm.add(person)
      }
  
  
      let dog = Dog()
      dog.name = "Fido"
      dog.owner = person
      try! realm.write {
          realm.add(dog)
      }
  
  
      print(person.dog?.name) // -&gt; result is nil
  </code></pre>
  
  <p>And also:</p>
  
  <pre><code>    let arbitraryPerson = realm.objects(Person).filter("name contains 'Harry'").first!
      let dogOwned = arbitraryPerson.dog
  
      print(dogOwned?.name) // -&gt; result is nil
  </code></pre>
  
  <p>It seems that ownedDog is always <code>nil</code>. Why could the inverse relation not be determined? Or should <code>dog</code> always be of <code>list&lt;T&gt;</code> type (i.e. to-many relationship) to force a relation between these objects? In this situation I get it working, but it feels not correct to force a to-many relationship when it isn't.</p>