How to implement an Index JOIN Clause in Couchbase Lite 2.0 using Objective-C API

Put together this unit test which does what you want and it works. I fetch Ids of joined docs. Also, you mentioned that you

Couldn’t find relevant examples in recent blog posts

. Did you check this blog out ?

- (void) testJoin {
    
    CBLMutableDocument* doc1 = [[CBLMutableDocument alloc] initWithID: @"doc1"];
    [doc1 setValue: @"foo" forKey: @"bar"];
    [self saveDocument: doc1];
    
    CBLMutableDocument* joinme = [[CBLMutableDocument alloc] initWithID: @"joinme"];
    [joinme setValue: @"doc1" forKey: @"theone"];
    [self saveDocument: joinme];
    
    CBLQuerySelectResult* MAIN_DOC_ID =
        [CBLQuerySelectResult expression: [CBLQueryMeta idFrom: @"main"]];

    
    CBLQueryExpression* on = [[CBLQueryMeta idFrom: @"main"]
                              equalTo: [CBLQueryExpression property:@"theone" from:@"secondary"]];
    CBLQueryJoin* join = [CBLQueryJoin join: [CBLQueryDataSource database: self.db as: @"secondary"]
                                         on: on];
    CBLQuery* q = [CBLQueryBuilder select: @[MAIN_DOC_ID]
                                     from: [CBLQueryDataSource database: self.db as: @"main"]
                                     join: @[join]];
    Assert(q);
    NSError* error;
    CBLQueryResultSet* rs = [q execute: &error];
    Assert(rs, @"Query failed: %@", error);
   
    for (CBLQueryResult *r in rs) {
        NSLog(@"%@",[r toDictionary]);
        AssertEqualObjects( [r valueForKey:@"id"],@"doc1");
       // You can use the doc Id to fetch the document and get relevant details
    }
 
}