Beginning Couchdb

Beginning Couchdb

Beginning CouchDB ■ ■ ■ JOE LENNON Beginning CouchDB Copyright © 2009 by Joe Lennon All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-7236-6 ISBN-13 (electronic): 978-1-4302-7237-3 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. President and Publisher: Paul Manning Lead Editor: Frank Pohlmann Technical Reviewer: Paul Davis Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Anne Collett Copy Editor: Kim Wimpsett Compositor: Kimberly Burton Indexer: Potomac Indexing, LLC Artist: April Milne Cover Designer: Kurt Krames Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer- sbm.com, or visit http://www.springeronline.com. For information on translations, please e-mail [email protected], or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com. You will need to answer questions pertaining to this book in order to successfully download the code. ii To the memory of my uncle, John, and my grandfather, Seán iii Contents at a Glance ■ABOUT THE AUTHOR.............................................................................................................. xiii ■ABOUT THE TECHNICAL REVIEWER ......................................................................................... xv ■ACKNOWLEDGEMENTS ......................................................................................................... xvii ■INTRODUCTION...................................................................................................................... xix ■CHAPTER 1: INTRODUCTION TO COUCHDB ................................................................................3 ■CHAPTER 2: INSTALLING COUCHDB ON LINUX ........................................................................11 ■CHAPTER 3: INSTALLING COUCHDB ON MAC OS X ..................................................................31 ■CHAPTER 4: CREATING YOUR FIRST COUCHDB DATABASE......................................................49 ■CHAPTER 5: USING FUTON: THE COUCHDB ADMINISTRATION INTERFACE ...............................63 ■CHAPTER 6: INTRODUCTION TO JSON.....................................................................................87 ■CHAPTER 7: INTRODUCTION TO COUCHDB VIEWS .................................................................107 ■CHAPTER 8: MAP/REDUCE....................................................................................................125 ■CHAPTER 9: ADVANCED COUCHDB VIEWS ............................................................................143 ■CHAPTER 10: DEVELOPING COUCHDB APPLICATIONS WITH COUCHAPP................................163 ■CHAPTER 11: DEVELOPING APPLICATIONS WITH COUCHDB ..................................................185 ■CHAPTER 12: ADVANCED COUCHDB TOPICS .........................................................................211 ■CHAPTER 13: MECHANICS OF COUCHDB DEPLOYMENT.........................................................241 ■APPENDIX A: COUCHDB API REFERENCE ..............................................................................251 ■APPENDIX B: HTTP AND CURL REFERENCE...........................................................................283 ■INDEX ..................................................................................................................................289 v ■ CONTENTS Contents About the Author .....................................................................................................xiii About the Technical Reviewer .................................................................................. xv Acknowledgements ................................................................................................ xvii Introduction............................................................................................................. xix Part 1: Getting Started................................................................................................1 ■Chapter 1: Introduction To CouchDB .......................................................................3 What Is CouchDB? .............................................................................................................3 CouchDB: The Story So Far................................................................................................4 Document-Oriented Databases..........................................................................................5 CouchDB Documents .........................................................................................................6 The Javascript View Engine...............................................................................................7 Restful HTTP API ................................................................................................................7 Futon..................................................................................................................................8 So...Now What? .................................................................................................................9 ■Chapter 2: Installing CouchDB on Linux ................................................................11 Installing CouchDB on Ubuntu Linux 8.10........................................................................11 Installing CouchDB on Fedora Linux Using Yum ..............................................................16 Building CouchDB (and Prerequisites) from Source Code ...............................................21 Building Erlang ....................................................................................................................................... 23 Building Libcurl....................................................................................................................................... 24 vii ■ CONTENTS CONTENTS Building Icu............................................................................................................................................. 25 Building Spidermonkey .......................................................................................................................... 25 Building Subversion................................................................................................................................ 26 Building CouchDB................................................................................................................................... 27 ■Chapter 3: Installing CouchDB on Mac OS X..........................................................31 Installing the Xcode Developer Tools...............................................................................31 Installing Macports ..........................................................................................................36 Installing CouchDB...........................................................................................................42 CouchDBx: a One-Click CouchDB Package for Mac OS X ................................................47 ■Chapter 4: Creating Your First CouchDB Database................................................49 Tools of the Trade............................................................................................................49 HTTP Requests.................................................................................................................50 JSON Response ...............................................................................................................50 Using curl.........................................................................................................................51 Creating Your First Database...........................................................................................51 Creating Documents in Your Contacts Database .............................................................54 Getting Started with CouchDB Views...............................................................................57 Summary .........................................................................................................................59

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    30 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us