On Mar 23, 2016, at 7:49 PM, Brendan Duddridge
<[email protected]<mailto:[email protected]>> wrote:
But then my map view table would actually contain all this duplicate data
taking up space that it didn't need to?
Yeah, but often you can use the same view/index for multiple queries. For
example, I wrote a little demo app a long time ago that stores your iTunes
library’s metadata in a database and lets you browse it; this one view allows
it to query for the Artists list, the Albums list, and track list of the
selected album, and the total time duration of whatever’s selected. The query
just needs to change the group level.
NSString* artist = doc[@"Artist"];
NSString* name = doc[@"Name"];
if (artist && name) {
if ([doc[@"Compilation"] boolValue]) {
artist = @"-Compilations-";
}
emit(@[artist,
doc[@"Album"] ?: [NSNull null],
doc[@"Track Number"] ?: [NSNull null],
name,
@1],
doc[@"Total Time"]);
}
(full source of the view definition
here<https://github.com/couchbaselabs/iOS-WorkerBee/blob/master/Tests/Test13_ITunesIndex.m>;
I’m not sure where the rest of the app ended up.)
—Jens
--
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/B1704BD9-FB11-4438-BAC7-D33DCDF6C6CB%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.