You have two options: Since these combination of things uniquely identifies a course you could set the _id field explicitly to something like subject:term:course_code. Choose whatever separator you need or encode the parts such that you can be sure you can always make sense of it.
The option option is to add a view to a design document which emits [subject, term, course_code]. Depending on the sorts of queries you want to do you should choose an ordering of these terms such that you can answer as many of your queries as possible with simple range requests. See http://wiki.apache.org/couchdb/View_collation for more information. Hope that helps! Randall On Wed, Aug 25, 2010 at 18:54, matt hebel <[email protected]> wrote: > Hello, my data is kind of unique and it will work best if i use couchDB to > store and retrieve the data but I'm having a hard time getting out what I > need. > > a document looks like this. > > { > "_id": "7d33b72f256fae4615dcea99cd7a2239", > "_rev": "1-587b7a9811db08f8abf925bc44a23bb9", > "term": "A", > "course_code": "1011", > "course_title": "Internet: Behind the Curtain", > "subject": "COMPSCI", > "section": "002", > "type": "LEC", > "class_number": 31912, > "building_room": "MC-105B", > "Instructor": "Andrews", > "full": false, > "time": [ > { > "day": "W", > "start": 1230, > "end": 1330 > }, > { > "day": "T", > "start": 1230, > "end": 1330 > } > ], > "days": { > "M": { > "s": 1230, > "e": 1330 > }, > "Tu": { > }, > "W": { > "s": 1430, > "e": 1530 > }, > "Thu": { > }, > "F": { > } > } > } > > > Where I'm having problems is getting out the sections that belong together. > I need to know that its from subject, term,course_code. If that data is not > provided i will end up with a mess of data that do not relate because there > are courses with course code 1011 in other subjects. Therefor make it unique > i need the subject, term, and course code. > > Should i design my documents differently? > > or how should i retrieve this data? > > > Matt >
