Good afternoon,
I am having some problems when trying to make a general find function
The inputs for this function are the repository (type of document),
indexName (property to emit as a key), indexMinValue (key's min value),
indexMaxValue (key's max value), limit and descending.
So my function looks like this:
- (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?
--
You received this message because you are subscribed to the Google Groups
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/b9ee31f2-eb6b-44c4-8e11-31ef2ac99dd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.