El 21/02/2012 18:12, Anthony escribió:
Hello, greetings to everyone, I'm super rookie using couchdb
How I can get the sum of the notes of a student? (classic join in relational database)
I was designed 2 doc (students and notes)


other quetions
How i get only the data of note of "juan"?


{
    type: "estudiante",
    id: 1,
   nombre: "juan"
}
{
    type: "estudiante",
    id: 2,
   nombre: "pepe"
}


{
    type: "nota",
    id: 1,
   nota:5,
   asignatura:"mat"
}
{
    type: "nota",
    id: 1,
   nota:4,
   asignatura:"fis"
}
{
    type: "nota",
    id: 1,
   nota:5,
   asignatura:"esp"
}
{
    type: "nota",
    id: 2,
   nota:5,
   asignatura:"esp"
}

thank



here is de solution , thank agains
function(doc) {

if (doc.tipo == 'estudiante') {
    emit([doc.id, "usuario"], doc.nombre);
} else if (doc.tipo == 'nota') {
    emit([doc.id, "notas"], [doc.asignatura,doc.nota]);
}


}


Fin a la injusticia, LIBERTAD AHORA A NUESTROS CINCO COMPATRIOTAS QUE SE 
ENCUENTRAN INJUSTAMENTE EN PRISIONES DE LOS EEUU!
http://www.antiterroristas.cu
http://justiciaparaloscinco.wordpress.com

Reply via email to