Finding design docs

Is it possible to run a query in CBL that will return all the design docs in the db?

Run an all-docs query with startKey="_design/" and endKey="_design/\uffffffff". Or (iOS/Mac only) instead of setting endKey set prefixMatchLevel=1 (in the REST API it’s called prefix_match_level.)


Tried both but I’m getting every document in the database returned.

What does your code look like?

I’m using the rest API and called GET at this url:


Perhaps the escaping of the end key isn’t working? My code has 8 fs but when i print the url out it looks like there’s only 4

Ugh, that’s got UTF-8 being URL-escaped. I think you’ll need to use a JSON Unicode escape, i.e. literally have \u in the JSON:


Or it’s simpler with prefix-matching:


Hmm, http://lite.couchbase./my_db/_all_docs?startKey=%22_design%2F%22&prefix_match_level=1 still returns all 11000+ rows in the db.

Ah, got it — it should be startkey not startKey.

This is super weird, now I’m getting fewer words back (but still thousands) using:


I tried the other method, but fixed the escaping (my bad!)


Which seems to work.