, free & fully virtual. June 9th - 10th. Register Now, free & fully virtual. June 9th - 10th. Register Now

Relationships between new and existing object Realm react-native

I would like to create a realtionship between a newly created object (lets say Identity) and a already existing object (let’s say City), also many identites should have a link to one City. I’ve tried on-to realationships, to-many realtionships and even inverse relationships but nothing seems to work. Every time I get the same error that I am trying to create an object with the same primary key.

Identity object is:

    insertIdentity = [{
      name: 'Identity',
        city: City,

Where both identity and city have primary keys.

Is what I need possible with realm?