0
votes

I have tried a couple of ways (using Fauxton with CouchDB 2.1.0) to retrieve Design documents only, but with no luck so far, meaning no documents returned. Can anyone tell me what is wrong with these?

// if the document structure contains the "views" Key:

function (doc) {
   if(doc.views)
   emit(doc._id, doc._rev);
}

// if the document ID starts with "_design":

function (doc) {
  if(doc._id.substring(0,7) == "_design")
  emit(doc._id, doc._rev);
}
1

1 Answers

0
votes

You should put special keys into design doc to make it index ddocs. Please read more about those options at http://docs.couchdb.org/en/1.6.1/api/ddoc/views.html#view-options