CodeFest 2010. Билык В. — CouchDB: от теории к практике
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

CodeFest 2010. Билык В. — CouchDB: от теории к практике

  • 1,678 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,678
On Slideshare
1,280
From Embeds
398
Number of Embeds
5

Actions

Shares
Downloads
10
Comments
0
Likes
0

Embeds 398

http://codefest.ru 364
http://2010.codefest.ru 20
http://backend.codefest.ru 10
http://backend.2gis.ru 2
http://2010.codefest.prod 2

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. http://www.erlang-factory.com/conference/London2009/speakers/endafarrell
  • 2. “The learning curve for CouchDB is quite shallow”
  • 3. “The only drawback is that you may need to do a lot of unlearning if you're well versed in SQL”
  • 4. Keys&Values
  • 5. { "type": "passport", "id": "F7802033", "countryCode": "IND", "surname": "Rai", "givenNames": [ "Aishwarya" ], "sex": "F", "birthDate": "01/11/1973", "placeOfIssue": "Mumbai" }
  • 6. { "type": "passport", "id": "F7802033", "countryCode": "IND", "surname": "Rai", "givenNames": [ "Aishwarya" ], "sex": "F", "birthDate": "01/11/1973", "placeOfIssue": "Mumbai" }
  • 7. function(doc) { if (doc.type == ʻpassportʼ) { emit(doc._id, doc); } }
  • 8. { "total_rows": 100500, "offset": 0, "rows": [ { "id": "F7802033", "key": "F7802033", "value": { "_id": "F7802033", "type": "passport", "countryCode": "IND", "surname": "Rai", ... } }, ...
  • 9. function(doc) { if (doc.type == ʻpassportʼ) { emit(doc._id, null); } }
  • 10. { "total_rows": 100500, "offset": 0, "rows": [ { "id": "F7802033", "key": "F7802033", "value": null }, ...
  • 11. ?include_docs=true ... "rows": [{ "id": "F7802033", "key": "F7802033", "value": null, "doc": { "_id": "F7802033", "type": "passport", "countryCode": "IND", "surname": "Rai", ... } }, ...
  • 12.      
  • 13. ?skip=100&limit=10 ...skip...skip... ...skip...skip... !
  • 14. ?startkey=foo&limit=11 ... ... !
  • 15. { "type": "comment", "post": "FFE2...", { "text": "Хотелось бы "_id": "FFE2...", сходить." "type": "post", ... "title": "Умники и умницы CodeFest", } "text": "Сегодня пятница, а значит осталась всего неделя до CodeFest { в Новосибирске..." "type": "comment", ... "post": "FFE2...", } "text": "Обязательно буду!" ... }
  • 16. function(doc) { if (doc.type == ʻpostʼ) { ["FFE2...",0] → {"type": "post", "title": "Умники и умницы CodeFest" ...} emit([doc._id,0], null); ["FFE2...",1] → {"type": "comment", } else if (doc.type == ʼcommentʼ) { "text": "Хотелось бы сходить."...} emit([doc.post,1], null); ["FFE2...",1] → {"type": "comment", "text": "Обязательно буду!"...} } }
  • 17. ? -42 Остроумный коментарий anonymous { "type": "comment_rating", "comment": "ABE2...", "rating": -1 ... }
  • 18. function( doc ) { if (doc.type == ʼcomment_ratingʼ ) { emit(doc.comment, doc.rating); } } function( keys, values ) { return sum(values); }
  • 19. ["heavy",191] → {"type": "boxer", "name": "David Deron Haye" ...} ... ["heavy",201] → {"type": "boxer", "name": "Vitaliy Klychko" ...} ... ["heavy",213] → {"type": "boxer", "name": "Nikolai Valuev" ...} GQL: SELECT * FROM Person WHERE birth_year >= :min_year AND height >= :min_height #ERROR
  • 20. function( doc ) { if (doc.type == ʼorderʼ ) { for(i in doc.orderLines) { for(j in doc.orderLines) { if ( i != j ) { emit( [ doc.orderLines[i].article , doc.orderLines[j].article ] , 1); } ... ...
  • 21. Cartesian explosion