Configuring MongoDB Realm for Unity with Specific Access Requirements

I’m developing a game using Unity and have several specific requirements related to data access:

  1. Players, via the Unity client, should be able to read from the database but not write to it directly.
  2. Any requirements for modifying, creating, or deleting data should be achieved through invoking Atlas functions.
  3. The Unity client needs to listen for changes to specific collections or individual documents in the database. Upon detecting these changes, the client should be able to execute corresponding Unity logic (e.g., if another player adds them as a friend, a UI notification should pop up in the game).
  4. Only a very limited set of data should be writable directly from the Unity client.

Can these requirements be met using the MongoDB Realm Unity SDK? Or is there a more appropriate approach to achieve this?

Yes, this is entirely possible - you can define fine grained permissions that will be applied whenever a write comes from the client allowing you to flat our reject all writes via Atlas Device Sync or allow only some of them based on rule expressions. Invoking functions can also be done directly via the Unity SDK.

1 Like

Many thanks, I will give it a try.