tags:

views:

78

answers:

1

I've followed the info at http://books.couchdb.org/relax/browsing-map-views as closely as possible but I'm not able to generate a view for my document.

My database name is "twitter" and my design document looks like this:

{
   "_id": "_design/testdocview",
   "_rev": "2-3250434125",
   "views": {
       "getRev": {
           "map": "function(doc) { if(doc._id == 'testdoc'){   emit('_rev', doc._rev); } }"
       }
   }
}

And it should be accessible at http://myurl/twitter/_view/testdocview/getRev. However, I get this error when trying to view it:

{"error":"not_found","reason":"missing"}

What am I doing wrong?

+4  A: 

The answer, for future reference to others, is the docs were out of date. The correct way to view a view is:

http://myurl/twitter/_design/testdocview/_view/getRev

Also, the json structure needs to look like:

{
  "_id":"_design/company",
  "_rev":"12345",
  "language": "javascript",
  "views":
  {
    "all": {
      "map": "function(doc) { if (doc.Type == 'customer')  emit(null, doc) }"
    }
  }
}
Geuis