
Redis
› SET note1:title "Mittag"› SET note1:message "nicht vergessen"› KEYS note1:*› GET note1:title› DEL note1:title ...
http://bit.ly/ISv9f6
R venDB a
››
›
› ›››
›
››
› › ››
using (var documentStore = new EmbeddableDocumentStore{ RunInMemory = true}.Initialize()){ us...
›››››
Ayende Rahien on the HTTP API - http://ravendb.net/documentation/docs-http-api-restful
› › ›C:>curl -X GET http://localhost:8080/docs/Categories/1 -iHTTP/1.1 200 OKContent-Type: application/json; charset=utf...
var notes = session var notes = session.Advanced.Query<Note>() .LuceneQuery...
MongoDB
CODASYL model SQL Agile becoming more Google MongoDB initial published ...
›››
–› use WebNote› db.Notes.save( { Title: Mittag, Message: nicht vergessen‘ } );› db.No...
–for(i=0; i<1000; i++) { [quiz, essay, exam].forEach(function(name) { var score = Math.floor(Math.random() * 50...
–› db.Notes.find();› db.Notes.find({ Title: /Test/i });› db.Notes.find( { "Categories.Color": "red"}).limit(1);
–› db.Notes.update({Title: Test}, {$set: {Categories: []}});› db.Notes.update({Title: Test}, ...
–› db.dropDatabase();› db.Notes.drop();› db.Notes.remove();
Consistency
Hands ON!
use diggdb.stories.findOne();
› use digg;› db.people.update({name: Smith}, {$set: {interests: []}});› db.people.update({name:...
var map = function() { emit(this.user.name, {diggs: this.diggs, posts: 0});};
var reduce = function(key, values) { var diggs = 0; var posts = 0; values.forEach(function(doc) { dig...
db.stories.mapReduce(map, reduce, {out: digg_users});db.digg_users.find();
JaWOHL!
Schema Design
http://bsonspec.org

> db.shapes.find()› { _id: "1", type: "c", area: 3.14, radius: 1}› { _id: "2", type: "s", area: 4, length: 2}› { ...
blogs: { author : “Johannes", date : ISODate("2011-09-18T09:56:06.298Z"), comments : [ { author : “...
blogs: { _id: 1000, author: “Johannes", date: ISODate("2011-09-18"), comments: [ {comment : 1)} ]}...
// Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [...
// Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [...
// Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [...
// Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [...
// Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [...
// Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [...
Software Tests

“ ” J.B. Rainsberger

using (var documentStore = new EmbeddableDocumentStore{ RunInMemory = true}.Initialize()){ us...
https://nuget.org/packages/Mongo2Go/
using (var runner = MongoDbRunner.Start()){ var collection = new MongoClient(runner.ConnectionString) .GetServer...
VielenDank!
P USE! A
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
of 125

2013-03-23 - NoSQL Spartakiade

My slides for the spartakiade conference in Berlin. I was talking about NoSQL with Redis, RavenDB and MongoDB. 145 hard slides - this is SPARTA!
Published on: Mar 4, 2016
Published in: Technology      
Source: www.slideshare.net


Transcripts - 2013-03-23 - NoSQL Spartakiade

  • 1. 
  • 2. Redis
  • 3. › SET note1:title "Mittag"› SET note1:message "nicht vergessen"› KEYS note1:*› GET note1:title› DEL note1:title note1:message
  • 4. http://bit.ly/ISv9f6
  • 5. R venDB a
  • 6. ››
  • 7. ›
  • 8. › ›››
  • 9. ›
  • 10. ››
  • 11. › › ››
  • 12. using (var documentStore = new EmbeddableDocumentStore{ RunInMemory = true}.Initialize()){ using (var session = documentStore.OpenSession()) { // Run complex test scenarious }}
  • 13. ›››››
  • 14. Ayende Rahien on the HTTP API - http://ravendb.net/documentation/docs-http-api-restful
  • 15. › › ›C:>curl -X GET http://localhost:8080/docs/Categories/1 -iHTTP/1.1 200 OKContent-Type: application/json; charset=utf-8ETag: 00000000-0000-0200-0000-000000000004{ "Name" : "Normal Importance", "Color" : "green"}
  • 16. var notes = session var notes = session.Advanced.Query<Note>() .LuceneQuery<Note>().Where(n => n.Category == "Important") .Where("Category:Important").ToArray(); .ToArray();
  • 17. MongoDB
  • 18. CODASYL model SQL Agile becoming more Google MongoDB initial published invented popular BigTable releaseIBM’s Oracle Brewer’s Amazon IMS INGRES founded CAP born Dynamo1966 1969 1970 1973 1974 1977 1985 1990’s 2000 2004 2007 2008 2009 10gen NoSQL Codd publishes Term “object-oriented founded Movement relational model paper database” appears in 1970 Apache Cassandra initial release
  • 19. ›››
  • 20. –› use WebNote› db.Notes.save( { Title: Mittag, Message: nicht vergessen‘ } );› db.Notes.save
  • 21. –for(i=0; i<1000; i++) { [quiz, essay, exam].forEach(function(name) { var score = Math.floor(Math.random() * 50) + 50; db.scores.save({student: i, name: name, score: score}); }); } db.scores.count();
  • 22. –› db.Notes.find();› db.Notes.find({ Title: /Test/i });› db.Notes.find( { "Categories.Color": "red"}).limit(1);
  • 23. –› db.Notes.update({Title: Test}, {$set: {Categories: []}});› db.Notes.update({Title: Test}, {$push: { Categories: {Color: Red} } });
  • 24. –› db.dropDatabase();› db.Notes.drop();› db.Notes.remove();
  • 25. Consistency
  • 26. Hands ON!
  • 27. use diggdb.stories.findOne();
  • 28. › use digg;› db.people.update({name: Smith}, {$set: {interests: []}});› db.people.update({name: Smith}, {$push: {interests: [chess]}});
  • 29. var map = function() { emit(this.user.name, {diggs: this.diggs, posts: 0});};
  • 30. var reduce = function(key, values) { var diggs = 0; var posts = 0; values.forEach(function(doc) { diggs += doc.diggs; posts += 1; }); return {diggs: diggs, posts: posts};};
  • 31. db.stories.mapReduce(map, reduce, {out: digg_users});db.digg_users.find();
  • 32. JaWOHL!
  • 33. Schema Design
  • 34. http://bsonspec.org
  • 35. 
  • 36. > db.shapes.find()› { _id: "1", type: "c", area: 3.14, radius: 1}› { _id: "2", type: "s", area: 4, length: 2}› { _id: "3", type: "r", area: 10, length: 5, width: 2}// Shapes mit radius > 0 finden> db.shapes.find( { radius: { $gt: 0 } } )
  • 37. blogs: { author : “Johannes", date : ISODate("2011-09-18T09:56:06.298Z"), comments : [ { author : “Klaus", date : ISODate("2011-09-19T09:56:06.298Z"), text : “toller Artikel" } ]}
  • 38. blogs: { _id: 1000, author: “Johannes", date: ISODate("2011-09-18"), comments: [ {comment : 1)} ]}comments : { _id : 1, blog: 1000, author : “Klaus", date : ISODate("2011-09-19")}> blog = db.blogs.find({ text: "Destination Moon" });> db.comments.find( { blog: blog._id } );
  • 39. // Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [ 20, 30 ] }
  • 40. // Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [ 20, 30 ] }// Jede Kategorie verlinkt die IDs der Produktecategories: { _id: 20, name: "adventure", product_ids: [ 10, 11, 12 ] }categories: { _id: 21, name: "movie", product_ids: [ 10 ] }
  • 41. // Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [ 20, 30 ] }// Jede Kategorie verlinkt die IDs der Produktecategories: { _id: 20, name: "adventure", product_ids: [ 10, 11, 12 ] }categories: { _id: 21, name: "movie", product_ids: [ 10 ] }// Alle Kategorien für ein Produkt> db.categories.find( { product_ids: 10 } )
  • 42. // Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [ 20, 30 ] }// Kategorien beinhalten keine Assoziationencategories: { _id: 20, name: "adventure"}
  • 43. // Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [ 20, 30 ] }// Kategorien beinhalten keine Assoziationencategories: { _id: 20, name: "adventure"}// Alle Produkte für eine Kategorie> db.products.find( { category_ids: 20 } )
  • 44. // Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [ 20, 30 ] }// Kategorien beinhalten keine Assoziationencategories: { _id: 20, name: "adventure"}// Alle Produkte für eine Kategorie> db.products.find( { category_ids: 20 } )// Alle Kategorien für ein Produkt product> product = db.products.find( { _id: some_id } )> db.categories.find({_id: {$in : product.category_ids}})
  • 45. Software Tests
  • 46. 
  • 47. “ ” J.B. Rainsberger
  • 48. 
  • 49. using (var documentStore = new EmbeddableDocumentStore{ RunInMemory = true}.Initialize()){ using (var session = documentStore.OpenSession()) { // Run complex test scenarious }}
  • 50. https://nuget.org/packages/Mongo2Go/
  • 51. using (var runner = MongoDbRunner.Start()){ var collection = new MongoClient(runner.ConnectionString) .GetServer() .GetDatabase("TestDatabase") .GetCollection<TestDocument>("TestCollection"); // Run complex test scenarious}
  • 52. VielenDank!
  • 53. P USE! A

Related Documents