couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Woodward <>
Subject View Including Documents It Doesn't Seem Like It Should
Date Thu, 03 May 2012 15:08:47 GMT
I'm sure Couch is doing exactly what it's supposed to so I'm really asking
in order to understand why it's behaving this way.

I'm working on a learning management system that has classes in it, and the
class document has (among other things) a course ID (a course has multiple
instances of classes associated with it), a learning method, and a

For reference the learning method value will be one of either Classroom,
Webinar, Videoconference, or Self-Paced, and my dates I'm formatting this
way: "2012/05/01 08:00"

I wrote a view that pulls classes with an array key including the course
ID, the learning method, and the date:

if (doc.type == 'class') { emit([doc.courseID, doc.learningMethod,
doc.dtStart], null); }

What I want to be able to pull is all classes for a specific course ID,
ordered by learning method, but within a specific date range.

When I use this start key, however, it pulls documents with a dtStart
values outside the date range:

["courseidhere","A","2012/05/01 00:00"]

In that case I'll get classes with a start date in April, for example. And
just so it's clear, I'm using "A" as the start key for the learning option
so I grab all the learning options.

As I said my guess is I'm not quite understanding how the array keys work
to the point where I get why given that start key it would pull documents
with dates before what I have in my start key, so I'd appreciate any
insight people might have.


Matthew Woodward / Twitter: @mpwoodward

Please do not send me proprietary file formats such as Word, PowerPoint,
etc. as attachments.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message