Code updating from Couchbase Lite 1.x to 3.x in iOS

What will be the equivalent of below code in Couchbase Lite 3.x ?

Below is the Objective C Couchbase Lite 1.x code


CBLDocument *doc = [self getDocumentWithKey:documentID];
CBLUnsavedRevision *unsavedRev = [doc.currentRevision createRevision];
[unsavedRev removeAttachmentNamed: attachmentName];
NSError* error;
[unsavedRev save: &error];


CBLDocument *document = [database createDocument];
NSError *error = nil;

if (![document putProperties:fnaForm error:&error]) {
    NSLog(@“Error: %@", error.localizedDescription);
} else {
    CBLUnsavedRevision *newRev = document.currentRevision.createRevision;
    UIImage *image = [UIImage imageWithData:form.source];
    NSData *imageData = UIImageJPEGRepresentation(image, 1);
    [newRev setAttachmentNamed:@"content.jpg" withContentType:@"image/jpeg" content:imageData];
    error = nil;
    [newRev save:&error];

See the Blobs section of the documentation for info on how to do this.

In the replicator we have a choice to reset the designated spots, by setting reset:true, what is its usefulness, does it really restart the entire replication activity, erasing the recently synchronized information or it resumes from the last effective replication and matches up the missing information. Set the reset:true choice, but to restart by erasing all recently matched up information and synchronizing all from the scratch, yet was really adjusting from where it left.

Kodi nox

When using reset = true, the replicator will reset the replication checkpoint before start syncing to determine which docs need to push or pull. It doesn’t erasing any docs unless the docs are deleted on the Sync Gateway side.

The reset mode is useful for the case that SG or CBS was restored from a backup or when you want to pull some docs back after being purged for example.