I'm getting query results that I don't understand.
I have a view to find a user's sent friend requests. It emits the following keys: [fromUUID, toUUID, updatedAt]. Then I create a query and set the start key to the user's UUID (myUUID), and the end key to an array: [myUUID, {}, {}]
I'm running into some weird cases. For example, if i set the start key to BCEE54E and the end key to [BCEE54E, {}, {}] I'll get results with keys like [A2A7B92, BCEE54E, 2015-11-18T11:35:16Z]
I would have thought that it would not include this key since the first string doesn't match.
i've posted the java code here: https://gist.github.com/joshblour/3fb6bc5aa0a5a4c72e20
the results are in the comments
CBLView* view = [db viewNamed: @"all_friend_requests_by_sender"];
if (!view.mapBlock) {
// Register the map function, the first time we access the view:
[view setMapBlock: MAPBLOCK({
if ([doc[@"type"] isEqualToString:kFriendRequestDocType]) {
emit(@[doc[@"fromUUID"], doc[@"toUUID"], doc[@"updatedAt"]], doc[@"status"]);
}
}) reduceBlock: nil version: @"2"]; // bump version any time you change the MAPBLOCK body!
}
CBLQuery *query = [view createQuery];
query.startKey = @[[self myUUID]];
query.endKey = @[[self myUUID], @{}, @{}];