I am using couchbase lite 1.3.0 for an ios app. I am saving the model objects as docs in the db. However I am changing the 'doctype' dynamically while saving. Upon querying with 'docType' id , the cbl view emits wrong/unmatching 'docType'. Couldn't figure out how to fix this.
[view setMapBlock: MAPBLOCK({
if ([doc[@"docType"] isEqual: @"docType1"])
{
emit(doc, nil);
}
})
version: @"1"];
CBLQuery* query = [view createQuery];
query.descending = NO;
CBLQueryEnumerator* result = [query run: &error];
for (CBLQueryRow* row in result) {
//The rows emitted doc of 'doctype2'
}