Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>CouchDB is not an SQL database engine. It's in the family of the "NoSQL" ones.</p> <p>You don't do select, you don't create tables, etc.</p> <p>It's completely different.</p> <p>It's actually using a REST API to work. Like, to access all the documents, you access them using an HTTP GET on the following URL: <a href="http://some.server/someDbName/_all_docs" rel="nofollow">http://some.server/someDbName/_all_docs</a></p> <p>For a more thorough introduction, I suggest looking for "CouchDB tutorial" on Google.</p> <p>You'll find good links like <a href="http://net.tutsplus.com/tutorials/getting-started-with-couchdb/" rel="nofollow">this one</a> or <a href="http://nosql.mypopescu.com/post/3767157786/couchdb-tutorial-getting-started-with-couchdb" rel="nofollow">this one</a>. (I'm not vouching for any, they just look good as an introduction.)</p> <p>To make an http request in node.js, you can use the <a href="http://nodejs.org/api/http.html#http_http_request_options_callback" rel="nofollow"><code>request</code></a> method of the built-in <code>http</code> module. A shortcut method is <code>http.get</code>, which you can use like this:</p> <pre><code>var http = require( 'http' ); http.get( 'http://some.url/with/params', function( res ) { // res has the values returned }); </code></pre> <p><strong>Edit after reading your code:</strong></p> <p>Firstly, the doc you're using if outdated. Node is at v0.8, not 0.4.</p> <p>Secondly, your <code>request = require('request')</code> must give some problems (does the module exist?). I don't think the first part is even executed.</p> <p>Thirdly, just try a GET request for now. Something like:</p> <pre><code>var http = require( 'http' ); http.get( 'http://localhost:5984/_all_dbs', function( res ) { console.log( res ); }); </code></pre> <p>See if it's working. If it is, you already know how to use couchdb ;)</p> <p>Lastly, your request at the end doesn't seem wrong. Maybe it's related to <code>require('request')</code> though, so I don't know.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload