- (NSMutableArray*) findGroup: (NSString *) repository
indexName: (NSString *) indexName
indexMinValue: (id) indexMinValue
indexMaxValue: (id) indexMaxValue
limit: (int) limit
descending: (BOOL) descending{
CBLView* findGroupView = [[self.couchDBProvider getLocalDB] viewNamed:@"findGroupView"];
[findGroupView setMapBlock: MAPBLOCK({
NSString* type= [doc valueForKey:@"type"];
if([type isEqualToString:repository]){
id orderKey = [doc valueForKey: indexName];
if(orderKey){
emit(orderKey, doc);
}
}
}) version: @"1.0"];
CBLQuery* findGroupQuery=findGroupView.createQuery;
And later I set the properties of findGroupQuery.
But I have problems as findGroupView doesn't always get as orderKey the value of the property given in the function (indexName).
Sometimes orderKey gets the value of other previously sent indexName variable.
Any help?