Hi, i'm working to insert couchbase in my iOS app and i am a bit stuck to
this stage:
I have to get all document of a given kind and extract only the ones have a
flag set true, so basically a normal query.
My actual method to do this is that:
- (NSArray *) getCompletedWorkouts{
NSError *error;
//1- createView
CBLView * contactInfoView = [_cl_database viewNamed: @
"getCompletedWorkouts"];
[contactInfoView setMapBlock: MAPBLOCK({
if (doc[@"workout"])
emit(doc[@"workout"], nil);
}) version: @"1"];
//2 - make the query
CBLQuery* query = [contactInfoView createQuery];
CBLQueryEnumerator* result = [query run: &error];
for(CBLQueryRow* row in result)
{
NSLog(@"Found document: %@", row.document);
}
if (error) {
NSLog(@"Document NOT found, error = %@", error.localizedDescription
);
}
return [NSArray array];
}
with this method i get in console all document, so how can i select only
documents of a kind and with said flag true? In particularly i didn't found
a lot of documentation on map block, is there the place where i have to
place the conditions?
Sorry for my newbieness in this field, but i found couchbase a bit hard to
understand at the start, more then other DB implementations. THX
--
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/e6c09860-8e71-4fd6-8b2a-1329c34b6db9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.