How do I pull all documents of the same 'type' on iOS?

I am trying to get all documents marked with the same ‘type’ field using a query as such:

CBLQueryBuilder *tagQueryBuilder = [[CBLQueryBuilder alloc]
                                    initWithDatabase: self.cbDatabase
                                    select: @[@"userID"]
                                    where: @"type == 'user_details'
                                    orderBy: nil
                                    error: &error];

CBLQueryEnumerator* e = [tagQueryBuilder runQueryWithContext: nil                                                                error: &error];
if (e) {//stuff here...
  } else {
    [self cb_handleError:error];

Which works fine! However really I want to pull the whole document (which has about 20 variables) and I don’t really want to put every variable in the select field (and make sure it stays updated) when I could just pull the whole document. But maybe querying just the userID and and then loading each document separately is inefficient? What is the best way of doing this?


If you need the whole document, you can access CBLQueryRow.document which will load the document. In that case it doesn’t matter what you put in the select: parameter, since a query always fetches the document ID.

Thanks Jens, this is exactly what I was after!