Local Replication of Databases

    +

    Description — Couchbase mobile database local replication concepts

    Description — Couchbase mobile database local replication concepts
    Related Content — Sync Gateway Replications | Peer-to-Peer Synchronization

    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:database2];
    CBLReplicatorConfiguration *config = [[CBLReplicatorConfiguration alloc] initWithDatabase:database target:targetDatabase];
    config.replicatorType = kCBLReplicatorTypePush;
    
    CBLReplicator *replicator = [[CBLReplicator alloc] initWithConfig:config];
    [replicator start];

    Note: The code does not compile in Couchbase Lite Community Edition.