A newer version of this documentation is available.

View Latest

Data Sync Locally on Device

      +

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

      Description — Couchbase Lite Database Sync - Synchronize changes between databases on the same device
      Related Content — Remote Sync Gateway | Peer-to-Peer Sync

      Overview

      Couchbase Lite supports replication between two local databases. This allows a Couchbase Lite replicator to store data on secondary storage. It is especially useful in scenarios where a user’s device may be damaged and its data moved to a different device.

      Example 1. Replication between Local Databases
      CBLDatabaseEndpoint *targetDatabase = [[CBLDatabaseEndpoint alloc] initWithDatabase:self.otherDB];
      CBLReplicatorConfiguration *config = [[CBLReplicatorConfiguration alloc] initWithDatabase:self.database target:targetDatabase];
      config.replicatorType = kCBLReplicatorTypePush;
      
      self.replicator = [[CBLReplicator alloc] initWithConfig:config];
      [self.replicator start];