I have been examining the Android couchbase lite GrocerySync application and have some questions.
How much should the map do?: I wrote a Mapper in my Android Java application to get precisely what was needed. For instance, to get items relevant for "today", I filtered on a date field and my mapper checked to see if the date was within today's date. After reading more I see that It may be better to write a Mapper that simply outputs documents by date, and then use parameters with my query to set startkey and endkey to filter the data. What is a more accepted practice and why?
Emitting values from maps: I've seen Java examples where the Mapper emits the entire document as it's value. I have read that maps should only emit the minimal keys to allow the client to access the required document. Does it make the view inefficient to provide values back from the map output? Does that view get too big? What if any are the problems doing this practice?
Development versus production views: I read about creating design documents and promoting them to production. Furthermore if I create views in a design document, I can access them via REST. I don't think I can access the views created from inside the GrocerySync application. I read that having temporary views was expensive and not a good idea. Considering the views created in the GrocerySync Java code, what kind of views are they? temporary? development? production? Can I access those views via REST? Are those views recreated everytime the application runs. Is the way they are created and used considered good practice?
Many views on same design document: If I keep creating more and different views with Mappers programmatically as does the GrocerySync application are all the views associated with the same design document? I read that having many views on a design document can be a bad thing. What are your thoughts on this?