O'Reilly logo

CouchDB and PHP Web Development Beginner's Guide by Tim Juravich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — creating new databases in CouchDB

In this exercise, we'll issue a PUT request, which will create a new database in CouchDB.

  1. Create a new database by running the following command in Terminal:
    curl -X PUT http://localhost:5984/test-db
    
    
  2. Terminal will respond with the following:
    {"ok":true}
    
    
  3. Try creating another database with the same name by running the following command in Terminal:
    curl -X PUT http://localhost:5984/test-db
    
    
  4. Terminal will respond with the following:
    {"error":"file_exists","reason":"The database could not be created, the file already exists."}
    
    
  5. Okay, that didn't work. So let's to try to create a database with a different name by running the following command in Terminal:
    curl -X PUT http://localhost:5984/another-db ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required