Q:

Stop Cloudant queries returning _design document

I am querying a Cloudant database with the NodeJS module, both with specific field searches and also with the function db.list(). However, I am (presumably correctly) also being returned all design documents. 
Is there a way to prevent design documents being returned ie when using list, without running a specific query to check the _id, or testing each item of the response from the database?
I cannot find a way to do it in the documentation, only the mention that _design documents are queried and updated like any other document, presumably why there are included in the list. 
Thanks

A:

The db.list() function is accessing Cloudant's _all_docs endpoint e.g.
https://reader.cloudant.com/animaldb/_all_docs

This returns all of a databases documents (including design documents) in key order.
As all design documents' ids start with a "_" character we can access only the "real" documents by saying
https://reader.cloudant.com/animaldb/_all_docs?startkey=%22a%22

i.e. find my all documents beginning with ones whose keys begin with "a".
In Node.js this looks like:
db.list({startkey:'a', include_docs:true}, function(err, data) {
  console.log(data);
})

Alternatively, you can create and index that will allow you to query and return subsets of your database. Design documents are not considered for indexing purposes so would not appear in the result set.

