Skip to content

Intra-device Sync

Couchbase Lite Database Sync - Synchronize changes between databases on the same device

Overview

This is an Enterprise Edition feature.

Couchbase Lite supports replication between two local databases at the database, scope, or collection level. This allows a Couchbase Lite replicator to store data on secondary storage. It is useful in scenarios when a user’s device is damaged and its data is moved to a different device.

Example 1. Replication between Local Databases

val repl = Replicator(
    ReplicatorConfigurationFactory.newConfig(
        target = DatabaseEndpoint(targetDb),
        collections = mapOf(srcCollections to null),
        type = ReplicatorType.PUSH
    )
)

// Start the replicator
repl.start()
// (be sure to hold a reference somewhere that will prevent it from being GCed)
this.replicator = repl