incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Clairon <>
Subject playing with tags
Date Thu, 12 Feb 2009 10:42:25 GMT
Hi there !

I'm playing with tags these time and a question comes to me.
For exemple, I have a bunch of blog articles:

article1 = {
  tags : ["couchdb", "python", "best practices"],

article2 = {
    tags : ["python", "best practices"],

article3 = {
    tags : ["couchdb", "best practices"],

and a view wich emit tags:

    if (doc.type=="article"){
        for (var i in doc.tags){
            emit( doc.tags[i], doc )

We can get all articles wich are tagged with "couchdb" easily:


but now, I want all articles wich are tagged with "couchdb" *and* "python"
(I want the article1). Is there a method to do it directly with CouchDB views ?
Something like that :

http://localhost:5984/blog/_view/article/by_tag?key_in=["couchdb", "python"]

For the moment, I have to do it by program,  firing 2 views and merge
the results...

We can also think something like this:

http://localhost:5984/blog/_view/article/by_tag?onekey_in=["couchdb", "python"]

wich will get all articles which are tagged with "couchdb" *or* "python"...

Does it already exists in CouchDB ?

View raw message