Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
While we're taking our break, do me a 
favour and type this into your Terminal: 
(swap your name & surname for mine) 
curl...
Lasso & CouchDB 
The happy couple. 
PRESENTER: Ari Najarian • @stickbyatlas 
#LDC2014 / @stickbyatlas
INTRODUCTION 
If I don’t include this slide, 
I’m probably going to forget to 
introduce myself. 
#LDC2014 / @stickbyatlas
INTRODUCTION 
If I don’t include this slide, 
I’m probably going to forget to 
introduce myself. 
#LDC2014 / @stickbyatlas...
INTRODUCTION 
I’ll be posting my slide deck 
online after the presentation. 
Look for a link to it on my 
Twitter stream. ...
INTRODUCTION 
What I hope to cover: 
CouchDB overview 
Demo & orientation 
Design documents 
Lasso usage patterns 
Integra...
INTRODUCTION 
I’ve provided further reading for 
most of the topics I discuss. 
You can find these links on 
Delicious: 
d...
INTRODUCTION 
A short history of 
my experience with 
relational databases. 
#LDC2014 / @stickbyatlas
INTRODUCTION 
Microsoft Access 
#LDC2014 / @stickbyatlas
INTRODUCTION 
MySQL 
#LDC2014 / @stickbyatlas
INTRODUCTION 
PostgreSQL 
#LDC2014 / @stickbyatlas
INTRODUCTION 
Filemaker Server 
#LDC2014 / @stickbyatlas
INTRODUCTION 
SQLite 
#LDC2014 / @stickbyatlas
INTRODUCTION 
Relational databases suck 
at being easy to use. 
Evidence: buggy tooling, obtuse 
configuration, and the fa...
INTRODUCTION 
Lasso’s Inline tag 
(and Ke’s Datasource) 
make interacting with 
relational databases easy. 
( This is a hu...
But what if I told you 
there was an easier way 
to persist data in your app? 
#LDC2014 / @stickbyatlas
Introducing CouchDB 
DOWNLOAD AT: couchdb.apache.org 
Let’s unpack this description a bit. 
#LDC2014 / @stickbyatlas
INTRODUCING COUCHDB 
It's noSQL 
What's this mean? 
#LDC2014 / @stickbyatlas
INTRODUCING COUCHDB 
JSON for documents 
#LDC2014 / @stickbyatlas
INTRODUCING COUCHDB 
Javascript for 
Map / Reduce indexes 
They're basically query expressions! 
#LDC2014 / @stickbyatlas
INTRODUCING COUCHDB 
HTTP for an API (!!) 
#LDC2014 / @stickbyatlas
INTRODUCING COUCHDB 
CouchDB can do 
master-master 
replication 
#LDC2014 / @stickbyatlas
INTRODUCING COUCHDB 
It powers some pretty 
awesome products. 
#LDC2014 / @stickbyatlas
INTRODUCING COUCHDB 
It has enterprise backing. 
#LDC2014 / @stickbyatlas
INTRODUCING COUCHDB 
It's concurrent & 
highly available 
CAP Theorem: A & P, not C 
#LDC2014 / @stickbyatlas
INTRODUCING COUCHDB 
It has an ecosystem! 
PouchDB , Couchbase Lite 
#LDC2014 / @stickbyatlas
A quick orientation 
Demo time! 
#LDC2014 / @stickbyatlas
Anatomy of a 
design document 
#LDC2014 / @stickbyatlas
ANATOMY OF A DESIGN DOC 
{ 
id : "_design/attendees" 
} 
#LDC2014 / @stickbyatlas
ANATOMY OF A DESIGN DOC 
{ 
id : "_design/attendees", 
views : { 
attendee_by_surname : function( doc ){ ... } 
} 
} 
#LDC...
ANATOMY OF A DESIGN DOC 
{ 
id : "_design/attendees", 
shows : { 
view_attendee : function( doc , req ){ ... } 
edit_atten...
ANATOMY OF A DESIGN DOC 
{ 
id : "_design/attendees", 
lists : { 
attendee_cards : function( head , req ){ ... } 
}, 
show...
ANATOMY OF A DESIGN DOC 
{ 
id : "_design/attendees", 
updates : { 
toggle_CLD : function(doc, req){ ... } 
}, 
lists : { ...
ANATOMY OF A DESIGN DOC 
{ 
id : "_design/attendees", 
validate_doc_update : function( doc, prev , req ){ ... }, 
updates ...
Basic usage patterns 
#LDC2014 / @stickbyatlas
BASIC USAGE PATTERNS 
Write a document to the database 
#LDC2014 / @stickbyatlas
BASIC USAGE PATTERNS 
Retrieve a document as a 
native Lasso map 
local("doc") = json_deserialize( 
include_url( 
"http://...
BASIC USAGE PATTERNS 
Retrieve an array of maps from a view 
local("products") = json_deserialize( 
include_url( 
"http://...
Update a document using an update handler. 
/_design/attendees/_update/toggle_CLD 
#LDC2014 / @stickbyatlas
Display pre-formatted data with a show function 
/_design/attendees/_show 
/DEMO_DOC 
{ 
"_id": "DEMO_DOC", 
"type": "atte...
Display pre-formatted data from a list function 
/_design/attendees/_list/attendee_cards 
/_design/attendees/_view/attende...
BASIC USAGE PATTERNS 
Cache & serve images via a Lasso proxy 
#LDC2014 / @stickbyatlas
BASIC USAGE PATTERNS 
Stream attachments from database 
RewriteRule ^/file/(.*) http://127.0.0.1:5984/database/$1 [P] 
<im...
How might you adopt 
CouchDB into your 
development team? 
#LDC2014 / @stickbyatlas
The integration continuum 
#LDC2014 / @stickbyatlas 
MOSTLY 
LASSO 
MOSTLY 
COUCHDB
THE INTEGRATION CONTINUUM 
Authentication 
#LDC2014 / @stickbyatlas
THE INTEGRATION CONTINUUM 
Document Validation 
#LDC2014 / @stickbyatlas
THE INTEGRATION CONTINUUM 
Templating 
#LDC2014 / @stickbyatlas
THE INTEGRATION CONTINUUM 
File uploads 
#LDC2014 / @stickbyatlas
THE INTEGRATION CONTINUUM 
Real-time applications 
#LDC2014 / @stickbyatlas
Advanced features 
& capabilities 
#LDC2014 / @stickbyatlas
ADVANCED FEATURES 
Geospatial queries 
GeoCouch by Volker Mische ( @vmx ) 
Point & bounding-box coordinates 
#LDC2014 / @s...
ADVANCED FEATURES 
Full-text search 
CouchDB Lucene 
#LDC2014 / @stickbyatlas
ADVANCED FEATURES 
Clustering 
BigCouch 
#LDC2014 / @stickbyatlas
ADVANCED FEATURES 
Offline-first development 
#LDC2014 / @stickbyatlas
The big picture 
Everyone else is trying to do this now. 
#LDC2014 / @stickbyatlas
Upcoming releases: 
MongoDB-like querying syntax 
BigCouch merge 
#LDC2014 / @stickbyatlas
CouchDB will challenge 
your notions of what databases 
can and should do. 
#LDC2014 / @stickbyatlas
Further reading: 
delicious.com / stickbyatlas / LDC2014 
#LDC2014 / @stickbyatlas
Questions? 
#LDC2014 / @stickbyatlas
Lasso and Couchdb : the happy couple
Nächste SlideShare
Wird geladen in …5
×

Lasso and Couchdb : the happy couple

1.416 Aufrufe

Veröffentlicht am

Presentation on CouchDB delivered at the 2014 Lasso Developer Conference, at Lassosoft HQ in Newmarket, Ontario.

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Lasso and Couchdb : the happy couple

  1. 1. While we're taking our break, do me a favour and type this into your Terminal: (swap your name & surname for mine) curl -X POST http://lasso.couchappy.com/ldc2014 -d '{"type":"attendee","name":"Ari","surname":"Najarian"}' -H 'Content-Type: application/json' #LDC2014 / @stickbyatlas
  2. 2. Lasso & CouchDB The happy couple. PRESENTER: Ari Najarian • @stickbyatlas #LDC2014 / @stickbyatlas
  3. 3. INTRODUCTION If I don’t include this slide, I’m probably going to forget to introduce myself. #LDC2014 / @stickbyatlas
  4. 4. INTRODUCTION If I don’t include this slide, I’m probably going to forget to introduce myself. #LDC2014 / @stickbyatlas If you have a question or a comment, I’ll be monitoring Twitter!
  5. 5. INTRODUCTION I’ll be posting my slide deck online after the presentation. Look for a link to it on my Twitter stream. #LDC2014 / @stickbyatlas
  6. 6. INTRODUCTION What I hope to cover: CouchDB overview Demo & orientation Design documents Lasso usage patterns Integrating CouchDB Advanced Features #LDC2014 / @stickbyatlas
  7. 7. INTRODUCTION I’ve provided further reading for most of the topics I discuss. You can find these links on Delicious: delicious.com / stickbyatlas / LDC2014 #LDC2014 / @stickbyatlas
  8. 8. INTRODUCTION A short history of my experience with relational databases. #LDC2014 / @stickbyatlas
  9. 9. INTRODUCTION Microsoft Access #LDC2014 / @stickbyatlas
  10. 10. INTRODUCTION MySQL #LDC2014 / @stickbyatlas
  11. 11. INTRODUCTION PostgreSQL #LDC2014 / @stickbyatlas
  12. 12. INTRODUCTION Filemaker Server #LDC2014 / @stickbyatlas
  13. 13. INTRODUCTION SQLite #LDC2014 / @stickbyatlas
  14. 14. INTRODUCTION Relational databases suck at being easy to use. Evidence: buggy tooling, obtuse configuration, and the fact that ORMs are an actual thing people use in basically every web language. #LDC2014 / @stickbyatlas
  15. 15. INTRODUCTION Lasso’s Inline tag (and Ke’s Datasource) make interacting with relational databases easy. ( This is a huge selling point! ) #LDC2014 / @stickbyatlas
  16. 16. But what if I told you there was an easier way to persist data in your app? #LDC2014 / @stickbyatlas
  17. 17. Introducing CouchDB DOWNLOAD AT: couchdb.apache.org Let’s unpack this description a bit. #LDC2014 / @stickbyatlas
  18. 18. INTRODUCING COUCHDB It's noSQL What's this mean? #LDC2014 / @stickbyatlas
  19. 19. INTRODUCING COUCHDB JSON for documents #LDC2014 / @stickbyatlas
  20. 20. INTRODUCING COUCHDB Javascript for Map / Reduce indexes They're basically query expressions! #LDC2014 / @stickbyatlas
  21. 21. INTRODUCING COUCHDB HTTP for an API (!!) #LDC2014 / @stickbyatlas
  22. 22. INTRODUCING COUCHDB CouchDB can do master-master replication #LDC2014 / @stickbyatlas
  23. 23. INTRODUCING COUCHDB It powers some pretty awesome products. #LDC2014 / @stickbyatlas
  24. 24. INTRODUCING COUCHDB It has enterprise backing. #LDC2014 / @stickbyatlas
  25. 25. INTRODUCING COUCHDB It's concurrent & highly available CAP Theorem: A & P, not C #LDC2014 / @stickbyatlas
  26. 26. INTRODUCING COUCHDB It has an ecosystem! PouchDB , Couchbase Lite #LDC2014 / @stickbyatlas
  27. 27. A quick orientation Demo time! #LDC2014 / @stickbyatlas
  28. 28. Anatomy of a design document #LDC2014 / @stickbyatlas
  29. 29. ANATOMY OF A DESIGN DOC { id : "_design/attendees" } #LDC2014 / @stickbyatlas
  30. 30. ANATOMY OF A DESIGN DOC { id : "_design/attendees", views : { attendee_by_surname : function( doc ){ ... } } } #LDC2014 / @stickbyatlas
  31. 31. ANATOMY OF A DESIGN DOC { id : "_design/attendees", shows : { view_attendee : function( doc , req ){ ... } edit_attendee : function( doc , req ){ ... } }, views : { attendee_by_surname : function( doc ){ ... } } } #LDC2014 / @stickbyatlas
  32. 32. ANATOMY OF A DESIGN DOC { id : "_design/attendees", lists : { attendee_cards : function( head , req ){ ... } }, shows : { view_attendee : function( doc , req ){ ... } edit_attendee : function( doc , req ){ ... } }, views : { attendee_by_surname : function( doc ){ ... } } } #LDC2014 / @stickbyatlas
  33. 33. ANATOMY OF A DESIGN DOC { id : "_design/attendees", updates : { toggle_CLD : function(doc, req){ ... } }, lists : { attendee_cards : function( head , req ){ ... } }, shows : { view_attendee : function( doc , req ){ ... } edit_attendee : function( doc , req ){ ... } }, views : { attendees_by_surname : function( doc ){ ... } } } #LDC2014 / @stickbyatlas
  34. 34. ANATOMY OF A DESIGN DOC { id : "_design/attendees", validate_doc_update : function( doc, prev , req ){ ... }, updates : { toggle_CLD : function(doc, req){ ... } }, lists : { attendee_cards : function( head , req ){ ... } }, shows : { view_attendee : function( doc , req ){ ... } edit_attendee : function( doc , req ){ ... } }, views : { attendees_by_surname : function( doc ){ ... } } } #LDC2014 / @stickbyatlas
  35. 35. Basic usage patterns #LDC2014 / @stickbyatlas
  36. 36. BASIC USAGE PATTERNS Write a document to the database #LDC2014 / @stickbyatlas
  37. 37. BASIC USAGE PATTERNS Retrieve a document as a native Lasso map local("doc") = json_deserialize( include_url( "http://127.0.0.1:5984/database/DOC_ID" ) ); #LDC2014 / @stickbyatlas
  38. 38. BASIC USAGE PATTERNS Retrieve an array of maps from a view local("products") = json_deserialize( include_url( "http://127.0.0.1:5984/database/_design/ddoc/_view/products" ) )->find("rows")->asstaticarray; #products = with( p in products select #p->find( "value" ) ); // VIEW: _design/ddoc/_view/products function( doc ){ if( doc.type == "product" ) emit( doc.product_name , doc ); } #LDC2014 / @stickbyatlas
  39. 39. Update a document using an update handler. /_design/attendees/_update/toggle_CLD #LDC2014 / @stickbyatlas
  40. 40. Display pre-formatted data with a show function /_design/attendees/_show /DEMO_DOC { "_id": "DEMO_DOC", "type": "attendee", "name": "Ari", "surname" : "Najarian" #LDC2014 / @stickbyatlas }
  41. 41. Display pre-formatted data from a list function /_design/attendees/_list/attendee_cards /_design/attendees/_view/attendees_by_surname #LDC2014 / @stickbyatlas
  42. 42. BASIC USAGE PATTERNS Cache & serve images via a Lasso proxy #LDC2014 / @stickbyatlas
  43. 43. BASIC USAGE PATTERNS Stream attachments from database RewriteRule ^/file/(.*) http://127.0.0.1:5984/database/$1 [P] <img src="/file/doc_id/attachment.jpg" /> #LDC2014 / @stickbyatlas
  44. 44. How might you adopt CouchDB into your development team? #LDC2014 / @stickbyatlas
  45. 45. The integration continuum #LDC2014 / @stickbyatlas MOSTLY LASSO MOSTLY COUCHDB
  46. 46. THE INTEGRATION CONTINUUM Authentication #LDC2014 / @stickbyatlas
  47. 47. THE INTEGRATION CONTINUUM Document Validation #LDC2014 / @stickbyatlas
  48. 48. THE INTEGRATION CONTINUUM Templating #LDC2014 / @stickbyatlas
  49. 49. THE INTEGRATION CONTINUUM File uploads #LDC2014 / @stickbyatlas
  50. 50. THE INTEGRATION CONTINUUM Real-time applications #LDC2014 / @stickbyatlas
  51. 51. Advanced features & capabilities #LDC2014 / @stickbyatlas
  52. 52. ADVANCED FEATURES Geospatial queries GeoCouch by Volker Mische ( @vmx ) Point & bounding-box coordinates #LDC2014 / @stickbyatlas
  53. 53. ADVANCED FEATURES Full-text search CouchDB Lucene #LDC2014 / @stickbyatlas
  54. 54. ADVANCED FEATURES Clustering BigCouch #LDC2014 / @stickbyatlas
  55. 55. ADVANCED FEATURES Offline-first development #LDC2014 / @stickbyatlas
  56. 56. The big picture Everyone else is trying to do this now. #LDC2014 / @stickbyatlas
  57. 57. Upcoming releases: MongoDB-like querying syntax BigCouch merge #LDC2014 / @stickbyatlas
  58. 58. CouchDB will challenge your notions of what databases can and should do. #LDC2014 / @stickbyatlas
  59. 59. Further reading: delicious.com / stickbyatlas / LDC2014 #LDC2014 / @stickbyatlas
  60. 60. Questions? #LDC2014 / @stickbyatlas

×