Create local realm first then cloud realm later

I would like to create a local realm on my mobile client device and release to production for our users. Then at some point in the future build out the sync capability to MongoDB Atlas. I read there is a default TTL of 30 days. Does this mean only the last 30 days of data will be uploaded when I set up sync in the future. Or is there a way to get all the local data to sync to the server the first time?

1 Like

The question is a bit unclear.

If you build a MongoDB Realm app with no sync, all of your data is persisted locally and does not time out or get removed. i.e. there is no expiration date of your data.

If you add Sync at a later time, that data would then Sync to the server and then it is persisted both locally and in the MongoDB Realm cloud - again, the data doesn’t expire.

From then on, the data is persisted in both locations; the cloud and locally. Are you asking if you then turn sync off what happens when you turn it back on after 30 days?

I think he is asking two questions:

  1. Will all the local data be synced if sync is added later on? - and the answer appears to be yes
  2. Subsequent to adding the sync will data start expiring? - and the answer appears to be no

So under what circumstances will data expire and what data expires? I am interested as at some point we will no doubt need to migrate off Realm Cloud but we don’t want any data to expire ever - we have our own archiving process for removing old data.

Data does not expire. ‘Persisted’ means that is stored and continually available (locally and when sync’d locally+cloud)

We have data stored in Realm (Cloud) from… 3+ years ago and it’s still there and available.

Are you seeing something that would indicate data would expire or otherwise be purged? I want to make sure I am addressing what’s being asked.

At the “Real Sync Docs” for 3.16.0 at Principles and "good to know" | 3.16.0 | Realm Sync (LEGACY) it says.

  • The server uses a per-Realm transaction history log file to allow correct integration of changesets irrespective of the order or time when the client sends the changesets.

  • The default time-to-live for the transaction history is 30 days. E.g. clients will have to connect at least once within that timeframe to ensure that changes are reflected. Outside of this time-frame the client will receive the most recent state from the server (“Client Reset”)

I guess this applies for server to client changes mostly so if the user has multiple devices and one device doesn’t log in for over 30 days, that device would be missing some changes. Also if you have a shared realm and make the changes server side, all the users that don’t log in for 30 days would also be missing some data.