Realm version vs Schema version? in Realm Sync with Kotlin Multiplatform

Hi all, I’m working on my first project with Realm Sync and MongoDB in Kotlin Multiplaform and it’s been working great so far. My question about the Realm version is the following: is it normal that every time I write data to my database my Realm version updates (I get the following message in my logs):

D/REALM: Updating Realm version: VersionId(version=52) → VersionId(version=53)

Is the realm version different than the schema version? If it updates everytime the realm version is going to grow quite fast. As far as I understand, the schema version is supposed to update automatically only when there have been changes to the model.

My code to add data is the following:

    suspend fun addSet(x: ExerciseSet): Boolean {
        return try {
            realm.write {
                copyToRealm(
                    x.apply {
                        this.owner_id = this@RealmDatabase.app.currentUser?.id ?: ""
                    }
                )
            }
            true
        } catch(e: Exception) {
            println("Failed to add set.")
            println(e.toString())
            false
        }
    }

Hi,

This is a different kind of version. Device Sync stores each write transaction that a client makes as a single “changeset” with a “version” (incrementing counter). This information is used by the sync protocol to ensure that all changes are eventually uploaded and that only the necessary deltas are exchanged. The docs page here has a good summary of the protocol if you are interested: https://www.mongodb.com/docs/atlas/app-services/sync/details/protocol/

Thanks,
Tyler

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