HI!
I am using CBL views in native iOS and Android for my PhoneGap app.
Is there any way to return after successfully emit one record and jump to next record in view in CouchBaseLite?
For example, here is my view :
[[[[CBLManager sharedInstance] databaseNamed: self.dbName error: &error] viewNamed: [self.dbName stringByAppendingString:@"/typewise_data_of_user"]] setMapBlock: MAPBLOCK({
NSString *type = [doc objectForKey:@"type"];
if (type)
{
if([type isEqualToString:@"board"])
emit(type, NULL);
else
{
BOOL is_active = (BOOL)[doc objectForKey: @"is_active"];
if(is_active)
{
NSString *sales_rep = [doc objectForKey:@"sales_rep"];
if(sales_rep)
{
emit(@[type, sales_rep], NULL);
}
NSArray* owners = (NSArray*)[doc objectForKey:@"owners"];
if(owners)
{
for (NSDictionary* owner1 in owners)
{
NSString *o_id = [owner1 objectForKey:@"id"];
if(owner1 != NULL)
{
emit(@[type, o_id], NULL);
}
}
}
}
}
}
}) reduceBlock:NULL version: @"1.5"];
I want to check sales_rep and owners both in one view. So, here I need to directly move to next record after 1st emit. That means, when we found a record with proper sales_rep, then I don't want to check for owners. I want to directly check next record.
Is there any functionality that allow me to return after successful emit?
Thanks!
Ami