couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wu,Shaolong" <S...@mdanderson.org>
Subject Any Javascript example for conenction to the couchDB server
Date Tue, 02 Mar 2010 19:55:44 GMT
Hi,

I am really at the beginning. I would like to use the couch.js at the client site. Couch.js
defines the CouchDB. But I did not find anything that specify the host information. How do
you specify the server host information?


Here is a simple thing I want to test first:

I want to use the couch.js. First connect to the server, then create a database, then insert
some doc.

<script type="text/javascript">

        function testCouchDB()
        {

            CouchDB.host = "127.0.0.1:5984"; // I know this is wrong, but how do I do that?

            var db = new CouchDB("test", {"X-Couch-Full-Commit":"false"});


            db.createDb();

            var nc = {_id:"NC", cities:["Charlotte", "Raleigh"]};
            var ma = {_id:"MA", cities:["Boston", "Lowell", "Worcester", "Cambridge", "Springfield"]};
            var fl = {_id:"FL", cities:["Miami", "Tampa", "Orlando", "Springfield"]};

            db.save(nc);
            db.save(ma);
            db.save(fl);

        }
        </script>






Shaolong Wu

System Analyst III
BCB Programming Service
Division of Quantitative Sciences
University of Texas MD Anderson Cancer Center
713-792-2604




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message