couchdbcouchdb-futon

How to bulk fetch by ids in couchdb without creating a view


I need to fetch couchdb documents by a bunch of ids. Is there an request / API to do it ? I don't want to create a view (id, docs) and then do a find by keys. when the id b-tree already exists


Solution

  • You should use the bulk API documented here.

    It could look something like below.

    curl -d '{"keys":["docId1","docId2","docId3"]}' -X POST http://127.0.0.1:5984/demodb/_all_docs?include_docs=true