I want to retrieve all the documents other than design documents but _all_docs returns all the documents in the DB. From the answers, I have found that using two queries would give the results.
_all_docs?endkey="_"- lists documents upto the first design doc_all_docs?startkey="design_\uffff"- lists documents after the design docs
This does not work if the document following the design docs, has _id "``test".
It gives the documents having _id beginning with small letters.
The ASCII of _ is 95, and that of backtick is 96. Small letters begin with 97.
So can the above query be modified to:
_all_docs?startkey="`"
You are quite correct that the
_all_docsendpoint does return design documents. As the_character sits between numbers + uppercase letters and the lowercase letters, the design documents appear just before documents starting with a lower case letter (or a backtick in your example).This leaves you with two choices:
Make two calls to
_all_docsto get the documents "either side" of the design documents:Or, create a new
MapReduceview. AsMapReduceviews do not index design documents, this allows you to get a list of all your documents (excluding design docs) in a single query.The map function could be as simple as
The query the view with
GET /mydb/_design/report/_view/myalldocs