• Save
Hotcode 2013: Javascript in a database (Part 1)
Upcoming SlideShare
Loading in...5
×
 

Hotcode 2013: Javascript in a database (Part 1)

on

  • 1,633 views

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

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

Statistics

Views

Total Views
1,633
Views on SlideShare
1,140
Embed Views
493

Actions

Likes
2
Downloads
0
Comments
0

2 Embeds 493

http://hotcode.org 477
https://twitter.com 16

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Hotcode 2013: Javascript in a database (Part 1) Hotcode 2013: Javascript in a database (Part 1) Presentation Transcript

    • JavaScript in the DatabaseFrank Celler & Lucas Dohmenwww.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
    • The NoSQL Movementwww.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
    • CAPwww.arangodb.org (c) f.celler@triagens.deACIDBASESamstag, 1. Juni 13
    • www.arangodb.org (c) f.celler@triagens.denosql.eventbrite.comdistributed structureddata storageSamstag, 1. Juni 13
    • 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
    • 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
    • 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
    • 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
    • www.arangodb.org (c) f.celler@triagens.de 9Samstag, 1. Juni 13
    • 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
    • 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
    • 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
    • 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
    • Why Use JavaScript?www.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
    • JavaScript Everywherein the BrowserApplication-Layer (Node.JS)Databasewww.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
    • Why is Node not enough?www.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
    • 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
    • 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
    • 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
    • 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
    • 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
    • No Back-End?www.arangodb.org (c) f.celler@triagens.deSamstag, 1. Juni 13
    • 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