incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rana Bunnni <rana_...@yahoo.se>
Subject difficult issue
Date Sun, 15 Sep 2013 10:07:07 GMT
Hi,
I have really and difficult issue.
in my CouchDB , i have two document: student , course
in a student document , i have the following properties(fields):

first_name: jan
last_name: box
type: student,
course_name: java

and in another document :
i have the following fields:

course_name : java
week: 20
type: course
teacher: Max
local: 4012

in my database , i have many students and each student study one course_name in the different
week. 
I want make view , that when i search after one student , can  i get all the weeks that he
has studied for a specified course? 
how can i do that ? please

I did it the following : but its not worked:
function(doc) {
  if(doc.type === "student"){
 var  name = doc.firstName; var courseName = doc.course;

if (doc.type === "course" && doc.courseName === courseName){
emit(doc.courseName,doc);
}
}
}

Best regards
Rana
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message