Search code examples
javascriptnode.jsnosqlcouchdbcouchdb-nano

How to get a table's data in couchdb


I'm very new to couchdb so my question may seem very simple; I'm using nano to connect to my couchdb; I have read most of the documentation, however I couldn't figure out how I can get all of the data in a table? What is the syntax to get all of the data of a table?


Solution

  • You may find this article useful.

    To get all of the documents in a database, you can use the _all_docs API endpoint, which nano wraps in its' db.list method.

    mydb.list(function(err, body) {
      if (!err) {
        body.rows.forEach(function(doc) {
          console.log(doc);
        });
      }
    });