CBLQuery *query = [someView createQuery]
query.prefetch = YES;
query.startKeyDocID =someDoc.documentID;
query.endKeyDocID = someDoc.documentID;
query.limit = 1;
NSMutableArray *rows = [NSMutableArray array];
NSError *__autoreleasing error;
for (CBLQueryRow *row in [query run:&error]) {
[rows addObject:row];
}
I expected rows to contain only 1 row which is the document id that I am looking for, but how it returns all rows from the query. I can filter out the documentID from the result, but it seems suboptimal.
Is there anyway just grab one document from a query?
Herman
On Oct 20, 2016, at 10:53 AM, Herman Chan <herm...@gmail.com> wrote:Ok, interesting, the key of the query I am calling consists of either "nil" or some UUID string, what should my startKey and endKey be in this case if I want to just get one document out of that query?