Update Realm relationship with primary ids <p>Is it possible to update a Realm object's relationships by passing only the ids of the relationships?</p> <p>If I have a <code>Library</code> class that has a <code>List&lt;Books&gt;</code> relationship and I wanted to merge two <code>Libraries</code> together, I would presume that could be done like:</p> <pre><code>let bookIds = (firstLibrary.books.toArray() + secondLibrary.books.toArray).map { $0.id } </code></pre> <p>Then I use ObjectMapper &amp; SugarRecord:</p> <pre><code>let changes = ["books": bookIds] Mapper&lt;T&gt;().map(changes, toObject: secondLibrary) let realm = self.realm realm.add(secondLibrary, update: true) </code></pre> <p>But the list of books doesn't get updated. I assume this is because ObjectMapper doesn't know anything about primary ids and therefore trying to map them into an object doesn't do anything.</p> <p>Does Realm have the capability to update via primary id? If it does, I'd gladly rewrite my persistence stack.</p>