Accessing other user's data for debugging purposes

We’re looking at implementing Realm in a mobile game (a text based RPG) for two reasons:

  1. Users can sync settings and progress on all devices
  2. We, as developers, can access user data for analytics and debugging purposes

My scenario is this:

A user encountered a bug in the game. His realm is synced, meaning that all game settings and process is available in our Atlas cloud. Now I want to access that user’s data in my own app in order to basically open the app as if I was the user in order to reproduce the bug.

Questions:

  1. Would I need to log in as the user in order to access the data, or could I somehow download his Realm to my app with some kind of admin credentials?
  2. Can I do this without writing back to the realm (altering the user’s data and progress in the game)

Depends on how exactly you structure your data, but if you’re using partition-based sync, you can add a rule that will grant read access for all partitions to your admin user. Then in the admin version of the game, you can select the user you want to impersonate and download that partition locally. Since you only have read access to it, you won’t be able to alter their progress.

1 Like

Ok, got it! A few more questions popped up in regards to your answer:

Then in the admin version of the game, you can select the user you want to impersonate and download that partition locally.

Question 1: How to query data from the MongoDB Realm
Ok, so let’s say we’re building this UI for admins where we can select which user we’d like to impersonate. If we were to build our own solution for syncing, we’d have some sort of API (GraphQL or REST) that we’d use to query the user to get this data. How would it work in this case? Use the GraphQL that’s built in to the MongoDB Realm service? Are there other ways?

Question 2: Impersonation vs copying
To my understanding, Realm Sync is based around the concept of basically keeping all data in sync across all devices, flawlessly. If we “impersonate” another user to get their data to our client, wouldn’t that mess with our own local data? Would it overwrite it? Would it merge? Would we have some kind of separate “dev realm” on the client to which we sync the user’s data? And would we use Realm to sync it - or does it make more sense to get it via API request and then push it into a local realm on our client?

I guess I’m trying to understand where the flexibility stops and the opinionated system starts when using Realm Sync, i.e. is all of this up to our implementation, or is there a fixed way of doing things when using Realm Sync?

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