What is the correct process to create schemas in react native?

So I am a bit lost. I am trying to make 2 collections, one is a master list that my users can only read from and the other is a collection of their own objects.

basically they choose from the master list an item, and then create a reference to it on their own document.

Is it possible to read collections from the realm in a fully synced app without defining the schema in my react-native app? If I do need to create one how do i match it exactly?

I added the schema locally for the reference and added a field for a BSON object id for the reference. (I am coming from Mongoose, I miss populate!)

Then I created the master list in the cloud and manually added some data. I managed to insert the new document with reference to the master list, but cannot pull from the master list. I assume I need a schema defined locally? I tried to make one locally that matches the cloud one but I cannot figure out the correct way to add the relationship.

I also now cannot delete the schema for the master list in the cloud and let the local one populate it since the other collection references it.

Currently my app will not build now as it states “Exception in host function: Property blah has been made required”, but it is not required in the cloud nor locally. But i have defined the schema using typescript and it’s possible that has made it required.
thank you for any info!

@Mike_Powell In the App Services there is a tab called Realm SDKs which contains a section called Realm Object Models. There you can copy and paste the exact schemas needed for your application. Hope that helps!
image

Hey Andrew!
Thank you so much for the reply, I ended up finding it after hours of struggle trying to match up my schemas. It only then introduced a whole new problem which was it removed my defaults, such as BSON.objectId = new BSON.objectId. So i had to write my schema similar to how I would write them in mongoose using {type: ‘objectId’, default: new BSON.objectId} and that did the trick.

Could you tell me the exact process for changing schema, My app is in development and I have had so much trouble with mismatching schemas.

I thought I understood the process was simple, make the change to my local schema, delete any data that does not match it from the db, remove the schema online and stop and restart sync. However this did not work. I ended up having to wipe all data from my simulator to get it to stop complaining finally.
In dev mode shouldn’t this be way easier, I should just be able to change it and it updates the cloud easily. I would much rather only deal with my local schema.

any help would be appreciated.

@Mike_Powell We are hoping to make the process a bit easier for breaking changes, but at the moment, if you do any modifications to your local schema (deletions or updates), you will need to wipe the local data.