incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabio Batalha Cunha dos Santos <fabio.bata...@scielo.org>
Subject querying inside a view function
Date Mon, 16 May 2011 19:43:24 GMT
Hello all,

In a view function, I would to query the database to get a specific info
that are stored in another document in the same database.

Is it possible considering that the index will not be completely finished?


I have the following type of documents in the same database:

*document A* - Journals

{[
   "_id": "d75058decf01df9d0de2d5ff544528da",


   "_rev": "1-1d8c14b10148436263bfba938b6ffc64",
   "journal_title": "Journal Title 1",

   "ISSN": "1234-1234",

   "area": "Health Sciences",

 "doc_type": "j"
],[
"_id": "d75058decf01df9d0de2d5ff544528da",
"_rev": "1-1d8c14b10148436263bfba938b6ffc64",
"journal_title": "Journal Title 2",
"ISSN": "5678-5678",

   "area": "Matematics"

   "doc_type": "j"
   ]
}


*document B* - Articles
{[

   "_id": "d75058decf01df9d0de2d5ff544528da",

   "_rev": "1-1d8c14b10148436263bfba938b6ffc64",

   "article_title": "Article Title 1",

   "ISSN": "1234-1234",

   "doc_type": "a",

   "CODE": "S1234-12342007000200002"

  ],[

   "_id": "d75058decf01df9d0de2d5ff544528da",

   "_rev": "1-1d8c14b10148436263bfba938b6ffc64",

   "article_title": "Article Title 2",

   "ISSN": "5678-5678",

   "doc_type": "a",

   "CODE": "S5678-56782009000200002"
 ]

}


function(doc) {
  if (doc.doc_type == 'a'){  // Getting Article Documents

      // I need to find a way to identify if the article document are from a
specific "area" but the area is defined just in journal documents
      // Could I retrieve the "journal_title" and the "area" according to
the ISSN from both documents?

      emit(doc.CODE, null);
  }
}

Thanks in advance.
*Fabio Batalha C. Santos*
Colegiado SciELO
www.scielo.org
FAPESP - CNPq - BIREME - FapUNIFESP

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