Data modelling for Realm


I’ve never used realm before, but I’ve built a lot of APIs and used a lot of RDBMS and am a certified Mongo developer. I’ve really liked the Realm presentations from Mongo live. But I’m keen on doing modelling well. So I’m just wondering, should data modelling be done differently when working with Mongo Realm? I’m just working through some of the docs, when you define role and permission on a collection and have the templates like Users can read and write their own data. Does that mean that you can’t have data elements that an administrator would manage within that collection. Thus, you need to separate your data more by user case? For example I have this document structure, that I use in a REST API, where the application holds all the business logic and can manage how certain admins can give access to certain functionality.

    name: "Mongo" // user defined
    teams: [ // defined by some administrator

But looking at the available templates for Realm, maybe this should be broken out? As you wouldn’t want a user to decide that he can see/perform actions to something an administrator. Am I wrong in this regard?

Thanks :slight_smile:

1 Like

I guess to a further extent, are there any recommendations on guides/videos/tutorials for working with Realm, for people who are technical, but never worked in this space, maybe a MongoDB University course planned?

@Jonny If you are talking about Realm Sync for mobile then yes you will generally want to split your data out more into separate documents because a document only lives in a single partition and permissions are defined per-partition per-user. Right now, you cannot add or remove fields within a document based on permissions although we are interested in improving this in the future. You can take a look at this Partitioning document here:

1 Like


Thanks for the reply and getting back to me, apologies in my delay. I did see this link and had a read, so I’m glad I got to the correct docs. Having read it, I think I get the way to manage the realms, so i’ll have a go and report back when I get chance

Thanks :slight_smile:

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.