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.

Hotcode 2013: Javascript in a database (Part 1)

2.424 Aufrufe

Veröffentlicht am

In this hotcode 2013 talk Lucas and Frank gave an overview over NoSQL and explained why Javascript

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

Hotcode 2013: Javascript in a database (Part 1)

  1. 1. JavaScript in the DatabaseFrank Celler & Lucas Dohmenwww.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
  2. 2. The NoSQL Movementwww.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
  3. 3. CAPwww.arangodb.org (c) f.celler@triagens.deACIDBASESamstag, 1. Juni 13
  4. 4. www.arangodb.org (c) f.celler@triagens.denosql.eventbrite.comdistributed structureddata storageSamstag, 1. Juni 13
  5. 5. Your EntitiesA Person has aName, first and lastone or more addresses, emails,telephonea list of hobbies, skills, tagswww.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
  6. 6. Relational Worldwww.arangodb.org (c) f.celler@triagens.dePersonPersonPersonAddressAddressAddressHobbyHobbyHobbyemailemailemailn-to-mn-to-mn-to-mn-to-mn-to-mn-to-mn-to-mn-to-mn-to-mSamstag, 1. Juni 13
  7. 7. Use AggregatesDo not Normalizewww.arangodb.org (c) f.celler@triagens.de{ name: { first: „Frank“, last: „Celler“ },address: { home: { street: „...“, city: „...“ } },email: { work: „frank@celler.de“ },hobbies: [ „C++“, „MRuby“, „JavaScript“ ] }Samstag, 1. Juni 13
  8. 8. Document Databasesdocuments can beas simple as key/value mapsor as complex as lists containing embeddedsub-documentsor anything in betweenrepresentated in JSONSchema-lesswww.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
  9. 9. www.arangodb.org (c) f.celler@triagens.de 9Samstag, 1. Juni 13
  10. 10. www.arangodb.org (c) f.celler@triagens.de 10Analytic Processing DBsTransaction Processing DBsManaging the evolving state of an IT systemMap/ReduceGraphsExtensibilityKey/ValueColumn-StoresComplexQueriesStructuredDataMassivelyDistributedDocumentsSamstag, 1. Juni 13
  11. 11. Property Graphswww.arangodb.org (c) f.celler@triagens.deType: inproceedingTitle: Finite Size EffectsType: proceedingTitle: Neural ModelingType: personName: Anthony C. C. CoolenLabel: writtenLabel: publishedPages: 99-120Type: personName: Snchez-AndrsLabel: editedJust DocumentsSamstag, 1. Juni 13
  12. 12. Multi-Model Databaseswww.arangodb.org (c) f.celler@triagens.devertices and edges are documentsquery them using geo-index, full-text,SQL-like queriesrelations are expressed as graphstraverse them using graph algorithmsSamstag, 1. Juni 13
  13. 13. ArangoDB.explain()www.arangodb.org (c) f.celler@triagens.de{"type": "NoSQL database","model": [ "document", "graph", "key-value" ],"openSource": true,"license“: "apache","version": 1.3,"builtWith": [ "C", "C++", "js" ],"Javascript": [ "client side", "server side" ],"uses": [ "V8" ]}Samstag, 1. Juni 13
  14. 14. Why Use JavaScript?www.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
  15. 15. JavaScript Everywherein the BrowserApplication-Layer (Node.JS)Databasewww.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
  16. 16. Why is Node not enough?www.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
  17. 17. JavaScript in a DatabaseMVC in the Browser and/or NODE.JSScript-Language in the DB fortransactions as functionsgraph traversalno-backend, just APIwww.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
  18. 18. db._create("accounts");db.accounts.save({ _key: "john", amount: 423 });db.accounts.save({ _key: "fred", amount: 197 });db._executeTransaction({collections: {write: "accounts"},params: {user1: "fred",user2: "john",amount: 10},action: function (params) {var db = require("internal").db;var account1 = db.accounts.document(params[user1]);var account2 = db.accounts.document(params[user2]);var amount = params[amount];if (account1.amount < amount) {throw "account of user " + user1 + " does not have enough money!";}db.accounts.update(account1, { amount : account1.amount - amount });db.accounts.update(account2, { amount : account2.amount + amount });/* will commit the transaction and return the value true */return true;}});www.arangodb.org (c) f.celler@triagens.deTransactionsSamstag, 1. Juni 13
  19. 19. db._executeTransaction({collections: {write: "accounts"},params: {user1: "fred",user2: "john",amount: 10},action: function (params) {var db = require("internal").db;var account1 = db.accounts.document(params[user1]);var account2 = db.accounts.document(params[user2]);var amount = params[amount];if (account1.amount < amount) {throw "account of user " + user1 + " does not have enough money!";}db.accounts.update(account1, { amount : account1.amount - amount });db.accounts.update(account2, { amount : account2.amount + amount });www.arangodb.org (c) f.celler@triagens.deTransactionsSamstag, 1. Juni 13
  20. 20. function traverse (graph, start, depth, maxlen) {var config = {datasource: traversal.collectionDatasourceFactory(graph._edges),strategy: Traverser.BREADTH_FIRST,expander: traversal.anyExpander,filter: traversal.maxDepthFilter,maxDepth: depth,uniqueness: { edges: Traverser.UNIQUE_GLOBAL, vertices: Traverser.UNIQUE_NONE },visitor: coauthorVisitor(maxlen)};var traverser = new Traverser(config);var result = { positions: {}, vertices: [], links: [], minYear: 0, maxYear: 0 };var first = graph._vertices.firstExample({ name: start });if (first !== null) {traverser.traverse(result, first);}return {start: start,depth: depth,minYear: result.minYear,maxYear: result.maxYear,vertices: result.vertices,links: result.links };}www.arangodb.org (c) f.celler@triagens.deGraph TraversalSamstag, 1. Juni 13
  21. 21. function traverse (graph, start, depth, maxlen) {var config = {datasource: traversal.collectionDatasourceFactory(graph._edges),strategy: Traverser.BREADTH_FIRST,expander: traversal.anyExpander,filter: traversal.maxDepthFilter,maxDepth: depth,uniqueness: { edges: Traverser.UNIQUE_GLOBAL,vertices: Traverser.UNIQUE_NONE },visitor: coauthorVisitor(maxlen)};www.arangodb.org (c) f.celler@triagens.deGraph TraversalSamstag, 1. Juni 13
  22. 22. No Back-End?www.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
  23. 23. To Be Continued ... NowFork me on githubGoogle Group: ArangoDBTwitter: @fceller & @arangodbwww.arangodb.orgwww.arangodb.org (c) f.celler@triagens.deStay in Touch:Samstag, 1. Juni 13

×