I have a simple question, How should I retrieve the document ids of all documents from a given database in couchdb.
I have written this code which retrieves all the documents-
docs=CouchRest.get("http://localhost:5984/competency1/_all_docs?include_docs=true")
puts docs.to_json
The above code displays the entire details of the database.I want to be able to list only the document id's.
I really appreciate your help.
Thanks.
2. /{db}/_all_docs. Executes the built-in _all_docs view, returning all of the documents in the database. With the exception of the URL parameters (described below), this endpoint works identically to any other view.
CouchDB will be downloaded to your system in the form of setup file named setup-couchdb-1.6. 1_R16B02.exe. Run the setup file and proceed with the installation. After installation, open built-in web interface of CouchDB by visiting the following link: http://127.0.0.1:5984/.
Apache CouchDB (CouchDB (link resides outside IBM)) is an open source NoSQL document database that collects and stores data in JSON-based document formats.
Advertisements. Documents are CouchDB's central data structure. Contents of the database will be stored in the form of Documents instead of tables. You can create these documents using cURL utility provided by CouchDB, as well as Futon.
From HTTP Document API about retrieving all documents:
To get a listing of all documents in a database, use the special _all_docs URI. ... Will return a listing of all documents and their revision IDs, ordered by DocID (case sensitive)
In other words, get /competency1/_all_docs
without the ?include_docs=true
part. This is the best solution for several reasons.
limit
, startkey,
endkey` options.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With