bodacydo
bodacydo

Reputation: 79299

How to access ALL documents in a CouchDB database?

How do I iterate over all CouchDB documents? As I know CouchDB can be accessed through curl but I'm unable to get to any documents because I can't figure out the syntax for URLs.

I've a database ibmuwarticles and I found the curl syntax for verifying that it exists through the _all_dbs parameter:

curl -X GET http://10.10.211.133:5984/_all_dbs 
["ibmuwarticles"]

But how do I actually access data in it? What would be the curl syntax and parameter after a slash to access data in ibmuwarticles?

I tried guessing and used _all_data slash parameter, but it didn't work

curl -X GET http://10.10.211.133:5984/_all_data
{"error":"illegal_database_name","reason":"Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."}

Upvotes: 5

Views: 19864

Answers (1)

Matthew Daly
Matthew Daly

Reputation: 9476

I believe the syntax is /db_name/_all_docs. See the documentation for further details.

So in your case it would be the following:

curl -X GET http://10.10.211.133:5984/ibmuwarticles/_all_docs

Hope that helps

Upvotes: 21

Related Questions