I was mistaken in which view was returning the problem ids. It is actually this view, which also has the built-in _count reduce function applied to it:
function (doc, meta) {
if (doc.type == "docType" && meta.id.split("_sync")[0] != "" && !doc._deleted && doc.userId && doc.startDateTime) {
var start = new Date(doc.startDateTime);
emit([doc.userId,start.getTime().toString()],null);
}
}
We query it using this code:
var query = ViewQuery.from('design_doc', 'viewName')
.stale(ViewQuery.Update.NONE)
.range([members[i], startDate], [members[i], endDate], true)
.reduce(false)
.full_set(true);
couchDb.query(query, function (err, results) {
So we are actually using Update.NONE for this one.