I made some changes to one of my Schemas in MongoDB Realm and then terminated and re-established sync. Now I am getting this message:
Error:
client file not found. The server has forgotten about the client-side file presented by the client. This is likely due to using a synchronized realm after terminating and re-enabling sync. Please wipe the file on the client to resume synchronization. { sessionIdent: 1, clientFileIdent: 35 } (ProtocolErrorCode=208)
Which file do I have to delete? Do I lose all my data?
For macOS, when using a local only Realm, the realm file is called default.realm. The 'default' part can be called whatever your app dictates it to be and can be stored anywhere within your device - again as the app dictates. By default it's stored in the Application Support folder (see below).
When using MongoDB Realm (sync) it's a different structure as each 'partition' is stored as a separate file, and the files are named per their partition name
They will be located in your users/your_name/Library/Application Support/com.your_developer_name.app name and looks like this for a Task Tracker application
and the files look like this:
In this case my app has two partitions: Task Tracker and Users so there are two files.
struct Constants {
static let REALM_APP_ID = "tasktracker-aaaaa"
static let REALM_PARTITION_VALUE = "Task Tracker"
static let USERS_PARTITION_VALUE = "Users"
}
If you want a total reset, you can toss the entire folder tasktracker-xxxxx. Keep in mind though, Realm does some caching and if your app has connected to realm, and is running, the files will re-generate. So ensure you delete those files when the app is closed OR if you do it within the app, before it connects to realm at any point. Or after all objects have been deallocated (which is tricky - use autorelease pool).
Link to Legacy Docs for deleting non-sync'd file for reference Delete Files
If you can't find the files add "print(Realm.Configuration.defaultConfiguration.fileURL!)" to your app in order to get the directory and then in finder paste the directory in GO to folder. There you will find the default.realm file and the mongodb-realm directory with the obsolete files. Deleted them and all GOOD!!