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

Relationships between new and existing object Realm react-native

Hi,
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',
      properties:{
        city: City,
      }
    }]

Where both identity and city have primary keys.

Is what I need possible with realm?