In my ios app, I have 2 document types:
- a List document type
- an Item document type

A List can contain many Items.
A lot of instances of my app can add items to the list at the same time,
and all instances are synchronized with sync gateway, so to avoid dealing
with conflicts, I chose to store Lists and Items in 2 different document
types instead of embedding items into lists. Maybe I was wrong, but that's
the way it works now.

I defined a view to display all the Lists sorted by creation date:

var listsView = database.viewNamed("listsView")
listsView.setMapBlock({ (doc, emit) -> Void in
    if doc["type"] as? String == "list" {
        emit(doc["date"], nil)
    }
}, version: "1")

And Item documents have a "list" property that contains the documentID of
the list that contains it.

All this works well.

But now in the viewcontroller that displays all the Lists, for each List, I
would like to display the number of Items that are associated with it.

Is there any way that I can modify my view so that it serves both to filter
list-type documents and keep track of the number of list-items in it?

Thx in advance,
---
Sébastien Arbogast
http://sebastien-arbogast.com

-- 
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/CAG1DMa_orDOUdNjw7_yCAQ78mg6nyzNZQQ17Jqt3qeZAbQhF7g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to