Hello

I'm having the following code to get  all items from a parent. And I want 
to order them by index. So I get everything from key parentId, but then I 
want to get all the records ordered by index. 
To test it I added 0 and 6 witch are the current minimum and maximum in my 
list. 

So the question is how I can do that without giving the maximum. 


    func getList() -> CBLQuery{

        let view = self.database.viewNamed("list")

        let block: CBLMapBlock = { (doc: [NSObject: AnyObject]!, emit: 
CBLMapEmitBlock!) in

            if(doc["type"] as NSString == "item"){

                emit([doc["item_id"]!, doc["index"]! as Int], doc)

            }

        }

        view.setMapBlock(block, reduceBlock: nil, version: "1")

        var query = view.createQuery()

        var parentId = self.document.documentID

        query.startKey = [parentId, 0]

        query.endKey = [parentId, 6]

        return query

    }


Thank You

-- 
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 mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/56e643fc-8fb1-4222-b37d-3c794c8c5846%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to