I have read a couple of articles about couchdb and nosql modelling because I’m
finally changing from mysql. Unfortunately I still haven’t been able to answer
a couple of questions, maybe someone can enlighten me.
i have a design document with views,lists,templates that make up an app and i’m
using the builtin web-server. My app works with appointments in calendars where
i have to check overlapping and minimum separation time on so on. that means
i’m working a lot with date ranges, durations and weekNumbers. Appointments can
also have linked/nested documents so sometimes i have to fetch other docTypes
with a doc.
questions:
- should view only contain _ids or also all the data you want to fetch?
- what do you do about nested Documents, get them in the view or fetch the
while rendering using lists / shows / templates (design doc)? For example
calling db.openDoc() in list to get data of doc or nested doc.
- when i check for overlapping should i use views and then write a js-function
to step through all results and check stuff or is it better to use nQ1-queries
(pseudo-sql)? For example:
appointment2.start >= appointment1.end + minSeperationTime &&
appointment2.end <= appointment3.start + minSeperationTime