5 Things You Didn't Know You Could do with CouchDB
-
Upload
mark-headd -
Category
Technology
-
view
1.375 -
download
0
description
Transcript of 5 Things You Didn't Know You Could do with CouchDB
Five Things You Didn't Know You Could do with CouchDB
Mark J. HeaddVoxeo Labs@mheadd
CouchDB in Review
• Document-oriented database (NoSQL).• "Schemaless."• Documents stored as JSON.• Queries ("views") structured as JavaScript Map/Reduce.• RESTful API - actually, more than 1:
o Bulk Document APIo Database APIo Document APIo Changes API
Geographic Queries
• Ability to query CouchDB based on location.• GeoCouch - formerly a separate fork of CouchDB proper.• GeoCouch baked in to CouchDB 1.0.2.• DBs with a "spatial" key in design doc - spatial indexing.• Special HTTP query to spatial view in design document.• Returns locations within specified bounding box.• Example.
Change Notifications
• _changes endpoint provides information on all changes.• Simple HTTP GET will list changes.• JSON payload delivered when change(s) occurs.• Long running HTTP connections.• Listening for specific changes with filters.• Example.
Formatting with List and Show
• Special types of design document elements - list and show.• Purpose is to render CouchDB docs in other formats.• Show functions operate on a specified document.• List functions operate on the output of view queries.• Both are "side effect free" - no additional operations.• Examples.
URL Rewriting
• URL paths to display output can be unfriendly.• CouchDB includes powerful rewrite features.• Special design document entry called "rewrites".• Special configuration setting "vhosts".• Ability to use short (friendly) URLs with CouchDB endpoints.• Can condition on HTTP method used, access params.• Example.
CouchApps
• Framework for serving HTML/JavaScript apps from Couch.• Leverages the formatting, rewrite features discussed.• Can leverage the same jQuery logic used by Futon.• Easy to deploy / replicate.• Remote Agent example.
Questions?