com presentations: First parts/updates for my ZendCon MongoDB tutorial: mongo-tut-zendcon12.xml slides/mongodb/id.xml slides/mongodb/idx-geo3.xml
slides/mongodb/idx-whats-in-store.xml slides/mongodb/one-to-many2.xml slides/mongodb/one-to-many3.xml slides/mongodb/one-to-many4.xml
slides/mongodb/safe2.xml slides/mongodb/types.xml slides/mongodb/update-modifiers.xml slides/mongodb/update2a.xml
| From: | Derick Rethans | Date: | Wed, 17 Oct 2012 09:56:12 +0000 |
| Subject: | com presentations: First parts/updates for my ZendCon MongoDB tutorial: mongo-tut-zendcon12.xml slides/mongodb/id.xml slides/mongodb/idx-geo3.xml slides/mongodb/idx-whats-in-store.xml slides/mongodb/one-to-many2.xml slides/mongodb/one-to-many3.xml slides/mongodb/one-to-many4.xml slides/mongodb/safe2.xml slides/mongodb/types.xml slides/mongodb/update-modifiers.xml slides/mongodb/update2a.xml |
||
| Groups: | php.pres | ||
| Request: | Send a blank email to pres+get-1853@lists.php.net to get a copy of this message | ||
Commit: 2b70dfa96a50edb9344abfa2b09564b55670a078
Author: Derick Rethans <github@derickrethans.nl> Wed, 17 Oct 2012 11:56:12 +0200
Parents: 087def5125aa25a7055cff25bc54214d2a9bc5eb
Branches: master
Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=2b70dfa96a50edb9344abfa2b09564b55670a078
Log:
First parts/updates for my ZendCon MongoDB tutorial
Changed paths:
A mongo-tut-zendcon12.xml
M slides/mongodb/id.xml
M slides/mongodb/idx-geo3.xml
M slides/mongodb/idx-whats-in-store.xml
M slides/mongodb/one-to-many2.xml
M slides/mongodb/one-to-many3.xml
M slides/mongodb/one-to-many4..xml
M slides/mongodb/safe2.xml
M slides/mongodb/types.xml
M slides/mongodb/update-modifiers.xml
M slides/mongodb/update2a.xml
diff --git a/mongo-tut-zendcon12.xml b/mongo-tut-zendcon12.xml new file mode 100644 index 0000000..eb41b07 --- /dev/null +++ b/mongo-tut-zendcon12.xml @@ -0,0 +1,193 @@ +<?xml version="1.0" encoding="utf-8"?> +<presentation css="10gen-strict.css"> +<topic>mongoDB</topic> +<title>Hands-On MongoDB</title> +<event>ZendCon 2012</event> +<location>Santa Clara, US</location> +<date>Oct 22nd, 2012</date> +<speaker>Derick Rethans</speaker> +<email>derick@10gen.com</email> +<twitter>derickr</twitter> +<url>http://derickrethans.nl/talks.html</url> +<joindin></joindin> +<slide>slides/mongodb/title.xml</slide> +<slide>slides/mongodb/me.xml</slide> + +<slide>slides/mongodb/databasefield.xml</slide> +<slide>slides/mongodb/collections-documents.xml</slide> +<slide>slides/mongodb/document.xml</slide> + +<slide>slides/mongodb/mongo-extension.xml</slide> +- install + - driver + - mongodb + +<slide>slides/mongodb/connecting.xml</slide> + +<slide>slides/mongodb/insert.xml</slide> +- single + +<slide>slides/mongodb/types.xml</slide> +- php types +- extra types (int32/64) +- id +<slide>slides/mongodb/id.xml</slide> +<slide>slides/mongodb/safe.xml</slide> +<slide>slides/mongodb/safe2.xml</slide> + +<slide>slides/mongodb/query.xml</slide> +<slide>slides/mongodb/query2.xml</slide> +- findOne +- find + +<slide>slides/mongodb/cursors.xml</slide> +- cursor +<slide>slides/mongodb/limit-skip.xml</slide> +- limit/skip + + +<slide>slides/mongodb/update-modifiers.xml</slide> +<slide>slides/mongodb/update2a.xml</slide> + +<slide>slides/mongodb/indexes2.xml</slide> +<slide>slides/mongodb/indexes3.xml</slide> +<slide>slides/mongodb/indexes4.xml</slide> + +<slide>slides/mongodb/commands.xml</slide> +<slide>slides/mongodb/commands-distinct.xml</slide> + +<!-- SCHEMA DESIGN --> +Common Patterns + +- RDBMS-normalisation. + +<slide>slides/mongodb/normalisation.xml</slide> +<slide>slides/mongodb/blog.xml</slide> +<slide>slides/mongodb/blog2.xml</slide> + +<slide>slides/mongodb/considerations.xml</slide> + +<slide>slides/mongodb/inherit.xml</slide> +<slide>slides/mongodb/inherit-rdbms.xml</slide> +<slide>slides/mongodb/inherit-mongo.xml</slide> +<slide>slides/mongodb/inherit-summary.xml</slide> + +<slide>slides/mongodb/one-to-many1.xml</slide> +<slide>slides/mongodb/one-to-many2.xml</slide> +<slide>slides/mongodb/tip-array-key.xml</slide> +<slide>slides/mongodb/one-to-many3.xml</slide> +<slide>slides/mongodb/one-to-many4.xml</slide> +<slide>slides/mongodb/tip-paged-result.xml</slide> + +<slide>slides/mongodb/many-to-many1.xml</slide> +<slide>slides/mongodb/many-to-many2.xml</slide> +<slide>slides/mongodb/many-to-many3.xml</slide> + +<slide>slides/mongodb/embed-vs-link.xml</slide> + +<!-- INDEXES --> +<slide>slides/mongodb/idx-whats-in-store.xml</slide> +<slide>slides/mongodb/idx-startup-quotes.xml</slide> +<slide>slides/mongodb/idx-startup-quotes2.xml</slide> +<slide>slides/mongodb/idx-startup-quotes3.xml</slide> + +<slide>slides/mongodb/idx-map.xml</slide> +<slide>slides/mongodb/idx-how-do-you-find-a-city.xml</slide> +<slide>slides/mongodb/idx-create.xml</slide> + +<slide>slides/mongodb/idx-cities-by-name.xml</slide> +<slide>slides/mongodb/idx-how-do-you-find-a-large-city.xml</slide> +<slide>slides/mongodb/idx-cities-by-name-and-pop.xml</slide> +<slide>slides/mongodb/idx-cities-by-name-and-pop2.xml</slide> +<slide>slides/mongodb/idx-cities-by-name-and-pop3.xml</slide> +<slide>slides/mongodb/idx-how-do-you-find-a-large-city-on-a-mountain.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem2.xml</slide> +<slide>slides/mongodb/idx-stored.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem3.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem4.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem6.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem5.xml</slide> + +<slide>slides/mongodb/idx-recap1.xml</slide> +<slide>slides/mongodb/idx-recap2.xml</slide> + + +<slide>slides/mongodb/idx-options.xml</slide> +<slide>slides/mongodb/idx-unique.xml</slide> +<slide>slides/mongodb/idx-sparse.xml</slide> +<slide>slides/mongodb/idx-sparse2.xml</slide> +<slide>slides/mongodb/idx-covered.xml</slide> +<slide>slides/mongodb/idx-multi-key.xml</slide> +<slide>slides/mongodb/idx-which-one-is-picked.xml</slide> +<slide>slides/mongodb/idx-or.xml</slide> + +<slide>slides/mongodb/idx-map2.xml</slide> +<slide>slides/mongodb/idx-geo.xml</slide> +<slide>slides/mongodb/idx-geo2.xml</slide> +<slide>slides/mongodb/idx-geo3.xml</slide> +<slide>slides/mongodb/idx-geo4.xml</slide> +<slide>slides/mongodb/idx-geo-geohash.xml</slide> + +unique +sparse +indexonly +multikey +2d + +<slide>slides/mongodb/idx-recap3.xml</slide> + +<!-- INTRODUCING OSM DATA --> +<slide>slides/map/osm-what.xml</slide> +<slide>slides/map/what-is-osm.xml</slide> +<slide>slides/map/osm-data.xml</slide> + +<slide>slides/map/osm-tags1.xml</slide> +<slide>slides/map/osm-tags2.xml</slide> +<slide>slides/map/osm-tags3.xml</slide> +<slide>slides/map/osm-tags4.xml</slide> +<slide>slides/map/osm-tags-edit.xml</slide> + + +<slide>slides/map/osm-parse-into-db.xml</slide> +<slide>slides/map/osm-xapi.xml</slide> +<slide>slides/mongodb/osm-to-mongo-data.xml</slide> +<slide>slides/mongodb/osm-to-mongo-data2.xml</slide> +<slide>slides/mongodb/osm-to-mongo-data3.xml</slide> +<slide>slides/mongodb/osm-to-mongo-data4.xml</slide> +<slide>slides/mongodb/osm-schema1.xml</slide> +<slide>slides/mongodb/osm-schema2.xml</slide> +<slide>slides/mongodb/osm-schema3.xml</slide> + + +<!-- REPLICATION --> +<slide>slides/mongodb/replication.xml</slide> +<slide>slides/mongodb/replication-setup.xml</slide> +- setup +- slaveOk +- journal +- write concerns +<slide>slides/mongodb/safe3.xml</slide> +<slide>slides/mongodb/read-preference.xml</slide> +<slide>slides/mongodb/php-connection-string.xml</slide> + +<slide>slides/mongodb/sharding.xml</slide> +- mongos +- diagram +- transparent + +<slide>slides/mongodb/resources.xml</slide> + +<!-- PERFORMANCE THINGS --> +<slide>slides/mongodb/mmap.xml</slide> + + +<!-- ADVANCED QUERY STUFF --> +<slide>slides/mongodb/query-advanced-ops.xml</slide> +<slide>slides/mongodb/query-advanced-example-array1.xml</slide> +<slide>slides/mongodb/query-advanced-example-array2.xml</slide> +<slide>slides/mongodb/upsert.xml</slide> + +<slide>slides/mongodb/resources.xml</slide> + +</presentation> diff --git a/slides/mongodb/id.xml b/slides/mongodb/id.xml index ce8d815..105ed64 100644 --- a/slides/mongodb/id.xml +++ b/slides/mongodb/id.xml @@ -3,6 +3,7 @@ <list> <bullet>Every document needs a unique ID</bullet> + <bullet>ID consists of: 4 bytes timestamp, 3 byte machine id, 2 bytes PID and 3 bytes counter: %|ff9999|507e6384| |99ff99|44670a| |9999ff|3e6e| |ffff99|000000|%</bullet> </list> <example result="1"><![CDATA[<?php diff --git a/slides/mongodb/idx-geo3.xml b/slides/mongodb/idx-geo3.xml index 83e6d47..2e54254 100644 --- a/slides/mongodb/idx-geo3.xml +++ b/slides/mongodb/idx-geo3.xml @@ -15,7 +15,7 @@ db.runCommand( { geoNear: 'cities', near: [ -0.088, 51.489 ], *spherical: true* <bullet>For 50°N and 13°E:<list> <bullet>|00cc00|%[13, -50]%|</bullet> <bullet>|00cc00|%{ lon : 13, lat : -50 }%|</bullet> - <bullet>|f10000|%{ lat : -50, lon : 13 }%|</bullet> + <bullet>|f15555|%{ lat : -50, lon : 13 }%|</bullet> </list></bullet> </list> </slide> diff --git a/slides/mongodb/idx-whats-in-store.xml b/slides/mongodb/idx-whats-in-store.xml index 9a5016a..815be7a 100644 --- a/slides/mongodb/idx-whats-in-store.xml +++ b/slides/mongodb/idx-whats-in-store.xml @@ -1,5 +1,5 @@ <slide> -<title>What's in store?</title> +<title>Indexes: What's in store?</title> <list> <bullet>What is indexing?</bullet> diff --git a/slides/mongodb/one-to-many2.xml b/slides/mongodb/one-to-many2.xml index d6b0dff..98fb129 100644 --- a/slides/mongodb/one-to-many2.xml +++ b/slides/mongodb/one-to-many2.xml @@ -1,24 +1,27 @@ <slide> -<title>One to Many (1:n)</title> - -<blurb>Embedded Array / Array Keys</blurb> -<list> - <bullet>some queries harder: e.g find all areas speaking German</bullet> -</list> +<title>Embedding Comments and Views</title> <example><![CDATA[{ - name: "Germany", - language: "German", - areas: [ - { name: "Bavaria", language: "Swabian" } + name: "Derick's MongoDB Tour Wrap-up", + date: "2012-10-01", + comments: [ + { name: "Adam", text: "It was great having you in Sou..." }, + { name: "Jake", text: "I don't think you can ever re..." }, + ], + views: [ + { time: 1350297458, ip: "192.168.42.101" }, + { time: 1350297729, ip: "192.168.42.103" }, + { time: 1350298912, ip: "192.168.42.102" }, ] }, { - name: "Switzerland", - areas: [ - { name: "Deutsche Schweiz", language: "German" }, - { name: "Romandy", language: "French" }, - { name: "Svizzera italiana", language: "Italian" }, + name: "What is PHP doing?", + date: "2012-07-13", + comments: [ + { name: "Chris", text: "The .gdbinit trick was somethi..." }, + ], + views: [ + { time: 1350297458, ip: "192.168.42.101" }, ] }]]></example> </slide> diff --git a/slides/mongodb/one-to-many3.xml b/slides/mongodb/one-to-many3.xml index 1ea0f70..ea4a3a2 100644 --- a/slides/mongodb/one-to-many3.xml +++ b/slides/mongodb/one-to-many3.xml @@ -1,7 +1,6 @@ <slide> -<title>One to Many (1:n)</title> +<title>Tree structure</title> -<blurb>Embedded Tree</blurb> <list> <bullet>single document</bullet> <bullet>natural</bullet> diff --git a/slides/mongodb/one-to-many4.xml b/slides/mongodb/one-to-many4.xml index bd0700b..bc538bc 100644 --- a/slides/mongodb/one-to-many4.xml +++ b/slides/mongodb/one-to-many4.xml @@ -1,23 +1,31 @@ <slide> -<title>One to Many (1:n)</title> +<title>Linking Articles and Views</title> -<blurb>Split out into multiple documents</blurb> -<list> - <bullet>most flexble</bullet> - <bullet>more queries</bullet> -</list> +<blurb>By splitting views out into their own collection</blurb> -<example><![CDATA[ -{ name: "Germany", language: "German", }, -{ name: "Bavaria", language: "Swabian", part_of: "Germany" }, - -// or: -{ - name: "Switzerland", - parts: [ 'Deutsche Schweiz', 'Romandy', 'Svizzera italiana' ] +<blurb>Article collection:</blurb> +<example><![CDATA[{ + _id: 4, + name: "Derick's MongoDB Tour Wrap-up", + date: "2012-10-01", + comments: [ + { name: "Adam", text: "It was great having you in Sou..." }, + { name: "Jake", text: "I don't think you can ever re..." }, + ], }, -{ name: "Deutsche Schweiz", language: "German" }, -{ name: "Romandy", language: "French" }, -{ name: "Svizzera italiana", language: "Italian" }, +{ + _id: 7, + name: "What is PHP doing?", + date: "2012-07-13", + comments: [ + { name: "Chris", text: "The .gdbinit trick was somethi..." }, + ] +}]]></example> +<blurb>Views collection:</blurb> +<example><![CDATA[ +{ article_id: 4, time: 1350297458, ip: "192.168.42.101" }, +{ article_id: 4, time: 1350297729, ip: "192.168.42.103" }, +{ article_id: 4, time: 1350298912, ip: "192.168.42.102" }, +{ article_id: 7, time: 1350297458, ip: "192.168.42.101" }, ]]></example> </slide> diff --git a/slides/mongodb/safe2.xml b/slides/mongodb/safe2.xml index 99ebf37..f0c2cc0 100644 --- a/slides/mongodb/safe2.xml +++ b/slides/mongodb/safe2.xml @@ -4,7 +4,7 @@ <blurb>Safeness levels:</blurb> <list> <bullet>Confirm change recorded in memory: %array( 'safe' => true );%</bullet> - <bullet>|777777|Confirm inclusion in journal: %array( 'j' => true );%|</bullet> + <bullet>Confirm inclusion in journal: %array( 'j' => true );%</bullet> <bullet>Confirm committed to disk: %array( 'fsync' => true );%</bullet> <bullet>Confirm replication: %array( 'safe' => true, 'w' => 2 );%</bullet> </list> diff --git a/slides/mongodb/types.xml b/slides/mongodb/types.xml index 0840269..6279a63 100644 --- a/slides/mongodb/types.xml +++ b/slides/mongodb/types.xml @@ -8,11 +8,9 @@ <bullet>double</bullet> <bullet>string (UTF-8)</bullet> <bullet>array</bullet> - <bullet>associative array</bullet> - <bullet>MongoRegex</bullet> - <bullet>MongoId</bullet> + <bullet>associative array ("object" for JavaScript)</bullet> + <bullet>MongoId (In the form of %4cb4ab6d7addf98506010000%)</bullet> <bullet>MongoDate</bullet> - <bullet>MongoCode</bullet> <bullet>MongoBinData</bullet> </list> </slide> diff --git a/slides/mongodb/update-modifiers.xml b/slides/mongodb/update-modifiers.xml index 1cdaaf8..947132b 100644 --- a/slides/mongodb/update-modifiers.xml +++ b/slides/mongodb/update-modifiers.xml @@ -3,24 +3,24 @@ <example><![CDATA[<?php $m = new Mongo; -$c = $m->demo->elephpants; +$c = $m->demo->presentations; $c->remove(); -$c->insert( [ - '_id' => 'e43', - 'name' => 'Dumbo' -] ); +$c->insert( array( + '_id' => 'mongo-tut-zendcon12', + 'name' => 'Hands-On MongoDB' +) ); $c->update( - [ 'name' => 'Dumbo' ], // criteria - [ '$set' => array [ 'age' => '17' ] ] // modifiers + array( 'name' => 'Hands-On MongoDB' ), // criteria + array( '$set' => array( 'lastviewed' => time() ) ) // modifiers ); -// document is now: -[ - '_id' => 'e43', - 'name' => 'Dumbo', - 'age' => '17', -] +/* document is now: +array( + '_id' => 'mongo-tut-zendcon12', + 'name' => 'Hands-On MongoDB' + 'lastviewed' => 1350296073, +) */ ?>]]></example> </slide> diff --git a/slides/mongodb/update2a.xml b/slides/mongodb/update2a.xml index 0426c0b..40e2017 100644 --- a/slides/mongodb/update2a.xml +++ b/slides/mongodb/update2a.xml @@ -7,16 +7,17 @@ <example result="0"><![CDATA[<?php $m = new Mongo; -$c = $m->demo->elephpants; +$c = $m->demo->products; $c->drop(); -$c->insert( [ '_id' => 'e42', 'name' => 'Kamubpo', 'age' => 17 ] ); -$c->insert( [ '_id' => 'e43', 'name' => 'Denali', 'age' => 17 ] ); +$c->insert( [ '_id' => 'blue-elephpant', 'generation' => 1, 'price' => 7.5 ] ); +$c->insert( [ '_id' => 'pink-elephpant', 'generation' => 2, 'price' => 8.0 ] ); +$c->insert( [ '_id' => 'green-elephpant', 'generation' => 3, 'price' => 7.5 ] ); $c->update( - [ 'age' => 17 ], // criteria - [ '$inc' => [ 'age' => 1 ] ], // update spec - [ 'multiple' => true ] // options: multiple + [ 'generation' => [ '$lte' => 2 ] ], // criteria + [ '$dec' => [ 'price' => 2.0 ] ], // update spec + [ 'multiple' => true ] // options: multiple ); ?>]]></example> </slide>
diff --git a/mongo-tut-zendcon12.xml b/mongo-tut-zendcon12.xml new file mode 100644 index 0000000..eb41b07 --- /dev/null +++ b/mongo-tut-zendcon12.xml @@ -0,0 +1,193 @@ +<?xml version="1.0" encoding="utf-8"?> +<presentation css="10gen-strict.css"> +<topic>mongoDB</topic> +<title>Hands-On MongoDB</title> +<event>ZendCon 2012</event> +<location>Santa Clara, US</location> +<date>Oct 22nd, 2012</date> +<speaker>Derick Rethans</speaker> +<email>derick@10gen.com</email> +<twitter>derickr</twitter> +<url>http://derickrethans.nl/talks.html</url> +<joindin></joindin> +<slide>slides/mongodb/title.xml</slide> +<slide>slides/mongodb/me.xml</slide> + +<slide>slides/mongodb/databasefield.xml</slide> +<slide>slides/mongodb/collections-documents.xml</slide> +<slide>slides/mongodb/document.xml</slide> + +<slide>slides/mongodb/mongo-extension.xml</slide> +- install + - driver + - mongodb + +<slide>slides/mongodb/connecting.xml</slide> + +<slide>slides/mongodb/insert.xml</slide> +- single + +<slide>slides/mongodb/types.xml</slide> +- php types +- extra types (int32/64) +- id +<slide>slides/mongodb/id.xml</slide> +<slide>slides/mongodb/safe.xml</slide> +<slide>slides/mongodb/safe2.xml</slide> + +<slide>slides/mongodb/query.xml</slide> +<slide>slides/mongodb/query2.xml</slide> +- findOne +- find + +<slide>slides/mongodb/cursors.xml</slide> +- cursor +<slide>slides/mongodb/limit-skip.xml</slide> +- limit/skip + + +<slide>slides/mongodb/update-modifiers.xml</slide> +<slide>slides/mongodb/update2a.xml</slide> + +<slide>slides/mongodb/indexes2.xml</slide> +<slide>slides/mongodb/indexes3.xml</slide> +<slide>slides/mongodb/indexes4.xml</slide> + +<slide>slides/mongodb/commands.xml</slide> +<slide>slides/mongodb/commands-distinct.xml</slide> + +<!-- SCHEMA DESIGN --> +Common Patterns + +- RDBMS-normalisation. + +<slide>slides/mongodb/normalisation.xml</slide> +<slide>slides/mongodb/blog.xml</slide> +<slide>slides/mongodb/blog2.xml</slide> + +<slide>slides/mongodb/considerations.xml</slide> + +<slide>slides/mongodb/inherit.xml</slide> +<slide>slides/mongodb/inherit-rdbms.xml</slide> +<slide>slides/mongodb/inherit-mongo.xml</slide> +<slide>slides/mongodb/inherit-summary.xml</slide> + +<slide>slides/mongodb/one-to-many1.xml</slide> +<slide>slides/mongodb/one-to-many2.xml</slide> +<slide>slides/mongodb/tip-array-key.xml</slide> +<slide>slides/mongodb/one-to-many3.xml</slide> +<slide>slides/mongodb/one-to-many4.xml</slide> +<slide>slides/mongodb/tip-paged-result.xml</slide> + +<slide>slides/mongodb/many-to-many1.xml</slide> +<slide>slides/mongodb/many-to-many2.xml</slide> +<slide>slides/mongodb/many-to-many3.xml</slide> + +<slide>slides/mongodb/embed-vs-link.xml</slide> + +<!-- INDEXES --> +<slide>slides/mongodb/idx-whats-in-store.xml</slide> +<slide>slides/mongodb/idx-startup-quotes.xml</slide> +<slide>slides/mongodb/idx-startup-quotes2.xml</slide> +<slide>slides/mongodb/idx-startup-quotes3.xml</slide> + +<slide>slides/mongodb/idx-map.xml</slide> +<slide>slides/mongodb/idx-how-do-you-find-a-city.xml</slide> +<slide>slides/mongodb/idx-create.xml</slide> + +<slide>slides/mongodb/idx-cities-by-name.xml</slide> +<slide>slides/mongodb/idx-how-do-you-find-a-large-city.xml</slide> +<slide>slides/mongodb/idx-cities-by-name-and-pop.xml</slide> +<slide>slides/mongodb/idx-cities-by-name-and-pop2.xml</slide> +<slide>slides/mongodb/idx-cities-by-name-and-pop3.xml</slide> +<slide>slides/mongodb/idx-how-do-you-find-a-large-city-on-a-mountain.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem2.xml</slide> +<slide>slides/mongodb/idx-stored.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem3.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem4.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem6.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem5.xml</slide> + +<slide>slides/mongodb/idx-recap1.xml</slide> +<slide>slides/mongodb/idx-recap2.xml</slide> + + +<slide>slides/mongodb/idx-options.xml</slide> +<slide>slides/mongodb/idx-unique.xml</slide> +<slide>slides/mongodb/idx-sparse.xml</slide> +<slide>slides/mongodb/idx-sparse2.xml</slide> +<slide>slides/mongodb/idx-covered.xml</slide> +<slide>slides/mongodb/idx-multi-key.xml</slide> +<slide>slides/mongodb/idx-which-one-is-picked.xml</slide> +<slide>slides/mongodb/idx-or.xml</slide> + +<slide>slides/mongodb/idx-map2.xml</slide> +<slide>slides/mongodb/idx-geo.xml</slide> +<slide>slides/mongodb/idx-geo2.xml</slide> +<slide>slides/mongodb/idx-geo3.xml</slide> +<slide>slides/mongodb/idx-geo4.xml</slide> +<slide>slides/mongodb/idx-geo-geohash.xml</slide> + +unique +sparse +indexonly +multikey +2d + +<slide>slides/mongodb/idx-recap3.xml</slide> + +<!-- INTRODUCING OSM DATA --> +<slide>slides/map/osm-what.xml</slide> +<slide>slides/map/what-is-osm.xml</slide> +<slide>slides/map/osm-data.xml</slide> + +<slide>slides/map/osm-tags1.xml</slide> +<slide>slides/map/osm-tags2.xml</slide> +<slide>slides/map/osm-tags3.xml</slide> +<slide>slides/map/osm-tags4.xml</slide> +<slide>slides/map/osm-tags-edit.xml</slide> + + +<slide>slides/map/osm-parse-into-db.xml</slide> +<slide>slides/map/osm-xapi.xml</slide> +<slide>slides/mongodb/osm-to-mongo-data.xml</slide> +<slide>slides/mongodb/osm-to-mongo-data2.xml</slide> +<slide>slides/mongodb/osm-to-mongo-data3.xml</slide> +<slide>slides/mongodb/osm-to-mongo-data4.xml</slide> +<slide>slides/mongodb/osm-schema1.xml</slide> +<slide>slides/mongodb/osm-schema2.xml</slide> +<slide>slides/mongodb/osm-schema3.xml</slide> + + +<!-- REPLICATION --> +<slide>slides/mongodb/replication.xml</slide> +<slide>slides/mongodb/replication-setup.xml</slide> +- setup +- slaveOk +- journal +- write concerns +<slide>slides/mongodb/safe3.xml</slide> +<slide>slides/mongodb/read-preference.xml</slide> +<slide>slides/mongodb/php-connection-string.xml</slide> + +<slide>slides/mongodb/sharding.xml</slide> +- mongos +- diagram +- transparent + +<slide>slides/mongodb/resources.xml</slide> + +<!-- PERFORMANCE THINGS --> +<slide>slides/mongodb/mmap.xml</slide> + + +<!-- ADVANCED QUERY STUFF --> +<slide>slides/mongodb/query-advanced-ops.xml</slide> +<slide>slides/mongodb/query-advanced-example-array1.xml</slide> +<slide>slides/mongodb/query-advanced-example-array2.xml</slide> +<slide>slides/mongodb/upsert.xml</slide> + +<slide>slides/mongodb/resources.xml</slide> + +</presentation> diff --git a/slides/mongodb/id.xml b/slides/mongodb/id.xml index ce8d815..105ed64 100644 --- a/slides/mongodb/id.xml +++ b/slides/mongodb/id.xml @@ -3,6 +3,7 @@ <list> <bullet>Every document needs a unique ID</bullet> + <bullet>ID consists of: 4 bytes timestamp, 3 byte machine id, 2 bytes PID and 3 bytes counter: %|ff9999|507e6384| |99ff99|44670a| |9999ff|3e6e| |ffff99|000000|%</bullet> </list> <example result="1"><![CDATA[<?php diff --git a/slides/mongodb/idx-geo3.xml b/slides/mongodb/idx-geo3.xml index 83e6d47..2e54254 100644 --- a/slides/mongodb/idx-geo3.xml +++ b/slides/mongodb/idx-geo3.xml @@ -15,7 +15,7 @@ db.runCommand( { geoNear: 'cities', near: [ -0.088, 51.489 ], *spherical: true* <bullet>For 50°N and 13°E:<list> <bullet>|00cc00|%[13, -50]%|</bullet> <bullet>|00cc00|%{ lon : 13, lat : -50 }%|</bullet> - <bullet>|f10000|%{ lat : -50, lon : 13 }%|</bullet> + <bullet>|f15555|%{ lat : -50, lon : 13 }%|</bullet> </list></bullet> </list> </slide> diff --git a/slides/mongodb/idx-whats-in-store.xml b/slides/mongodb/idx-whats-in-store.xml index 9a5016a..815be7a 100644 --- a/slides/mongodb/idx-whats-in-store.xml +++ b/slides/mongodb/idx-whats-in-store.xml @@ -1,5 +1,5 @@ <slide> -<title>What's in store?</title> +<title>Indexes: What's in store?</title> <list> <bullet>What is indexing?</bullet> diff --git a/slides/mongodb/one-to-many2.xml b/slides/mongodb/one-to-many2.xml index d6b0dff..98fb129 100644 --- a/slides/mongodb/one-to-many2.xml +++ b/slides/mongodb/one-to-many2.xml @@ -1,24 +1,27 @@ <slide> -<title>One to Many (1:n)</title> - -<blurb>Embedded Array / Array Keys</blurb> -<list> - <bullet>some queries harder: e.g find all areas speaking German</bullet> -</list> +<title>Embedding Comments and Views</title> <example><![CDATA[{ - name: "Germany", - language: "German", - areas: [ - { name: "Bavaria", language: "Swabian" } + name: "Derick's MongoDB Tour Wrap-up", + date: "2012-10-01", + comments: [ + { name: "Adam", text: "It was great having you in Sou..." }, + { name: "Jake", text: "I don't think you can ever re..." }, + ], + views: [ + { time: 1350297458, ip: "192.168.42.101" }, + { time: 1350297729, ip: "192.168.42.103" }, + { time: 1350298912, ip: "192.168.42.102" }, ] }, { - name: "Switzerland", - areas: [ - { name: "Deutsche Schweiz", language: "German" }, - { name: "Romandy", language: "French" }, - { name: "Svizzera italiana", language: "Italian" }, + name: "What is PHP doing?", + date: "2012-07-13", + comments: [ + { name: "Chris", text: "The .gdbinit trick was somethi..." }, + ], + views: [ + { time: 1350297458, ip: "192.168.42.101" }, ] }]]></example> </slide> diff --git a/slides/mongodb/one-to-many3.xml b/slides/mongodb/one-to-many3.xml index 1ea0f70..ea4a3a2 100644 --- a/slides/mongodb/one-to-many3.xml +++ b/slides/mongodb/one-to-many3.xml @@ -1,7 +1,6 @@ <slide> -<title>One to Many (1:n)</title> +<title>Tree structure</title> -<blurb>Embedded Tree</blurb> <list> <bullet>single document</bullet> <bullet>natural</bullet> diff --git a/slides/mongodb/one-to-many4.xml b/slides/mongodb/one-to-many4.xml index bd0700b..bc538bc 100644 --- a/slides/mongodb/one-to-many4.xml +++ b/slides/mongodb/one-to-many4.xml @@ -1,23 +1,31 @@ <slide> -<title>One to Many (1:n)</title> +<title>Linking Articles and Views</title> -<blurb>Split out into multiple documents</blurb> -<list> - <bullet>most flexble</bullet> - <bullet>more queries</bullet> -</list> +<blurb>By splitting views out into their own collection</blurb> -<example><![CDATA[ -{ name: "Germany", language: "German", }, -{ name: "Bavaria", language: "Swabian", part_of: "Germany" }, - -// or: -{ - name: "Switzerland", - parts: [ 'Deutsche Schweiz', 'Romandy', 'Svizzera italiana' ] +<blurb>Article collection:</blurb> +<example><![CDATA[{ + _id: 4, + name: "Derick's MongoDB Tour Wrap-up", + date: "2012-10-01", + comments: [ + { name: "Adam", text: "It was great having you in Sou..." }, + { name: "Jake", text: "I don't think you can ever re..." }, + ], }, -{ name: "Deutsche Schweiz", language: "German" }, -{ name: "Romandy", language: "French" }, -{ name: "Svizzera italiana", language: "Italian" }, +{ + _id: 7, + name: "What is PHP doing?", + date: "2012-07-13", + comments: [ + { name: "Chris", text: "The .gdbinit trick was somethi..." }, + ] +}]]></example> +<blurb>Views collection:</blurb> +<example><![CDATA[ +{ article_id: 4, time: 1350297458, ip: "192.168.42.101" }, +{ article_id: 4, time: 1350297729, ip: "192.168.42.103" }, +{ article_id: 4, time: 1350298912, ip: "192.168.42.102" }, +{ article_id: 7, time: 1350297458, ip: "192.168.42.101" }, ]]></example> </slide> diff --git a/slides/mongodb/safe2.xml b/slides/mongodb/safe2.xml index 99ebf37..f0c2cc0 100644 --- a/slides/mongodb/safe2.xml +++ b/slides/mongodb/safe2.xml @@ -4,7 +4,7 @@ <blurb>Safeness levels:</blurb> <list> <bullet>Confirm change recorded in memory: %array( 'safe' => true );%</bullet> - <bullet>|777777|Confirm inclusion in journal: %array( 'j' => true );%|</bullet> + <bullet>Confirm inclusion in journal: %array( 'j' => true );%</bullet> <bullet>Confirm committed to disk: %array( 'fsync' => true );%</bullet> <bullet>Confirm replication: %array( 'safe' => true, 'w' => 2 );%</bullet> </list> diff --git a/slides/mongodb/types.xml b/slides/mongodb/types.xml index 0840269..6279a63 100644 --- a/slides/mongodb/types.xml +++ b/slides/mongodb/types.xml @@ -8,11 +8,9 @@ <bullet>double</bullet> <bullet>string (UTF-8)</bullet> <bullet>array</bullet> - <bullet>associative array</bullet> - <bullet>MongoRegex</bullet> - <bullet>MongoId</bullet> + <bullet>associative array ("object" for JavaScript)</bullet> + <bullet>MongoId (In the form of %4cb4ab6d7addf98506010000%)</bullet> <bullet>MongoDate</bullet> - <bullet>MongoCode</bullet> <bullet>MongoBinData</bullet> </list> </slide> diff --git a/slides/mongodb/update-modifiers.xml b/slides/mongodb/update-modifiers.xml index 1cdaaf8..947132b 100644 --- a/slides/mongodb/update-modifiers.xml +++ b/slides/mongodb/update-modifiers.xml @@ -3,24 +3,24 @@ <example><![CDATA[<?php $m = new Mongo; -$c = $m->demo->elephpants; +$c = $m->demo->presentations; $c->remove(); -$c->insert( [ - '_id' => 'e43', - 'name' => 'Dumbo' -] ); +$c->insert( array( + '_id' => 'mongo-tut-zendcon12', + 'name' => 'Hands-On MongoDB' +) ); $c->update( - [ 'name' => 'Dumbo' ], // criteria - [ '$set' => array [ 'age' => '17' ] ] // modifiers + array( 'name' => 'Hands-On MongoDB' ), // criteria + array( '$set' => array( 'lastviewed' => time() ) ) // modifiers ); -// document is now: -[ - '_id' => 'e43', - 'name' => 'Dumbo', - 'age' => '17', -] +/* document is now: +array( + '_id' => 'mongo-tut-zendcon12', + 'name' => 'Hands-On MongoDB' + 'lastviewed' => 1350296073, +) */ ?>]]></example> </slide> diff --git a/slides/mongodb/update2a.xml b/slides/mongodb/update2a.xml index 0426c0b..40e2017 100644 --- a/slides/mongodb/update2a.xml +++ b/slides/mongodb/update2a.xml @@ -7,16 +7,17 @@ <example result="0"><![CDATA[<?php $m = new Mongo; -$c = $m->demo->elephpants; +$c = $m->demo->products; $c->drop(); -$c->insert( [ '_id' => 'e42', 'name' => 'Kamubpo', 'age' => 17 ] ); -$c->insert( [ '_id' => 'e43', 'name' => 'Denali', 'age' => 17 ] ); +$c->insert( [ '_id' => 'blue-elephpant', 'generation' => 1, 'price' => 7.5 ] ); +$c->insert( [ '_id' => 'pink-elephpant', 'generation' => 2, 'price' => 8.0 ] ); +$c->insert( [ '_id' => 'green-elephpant', 'generation' => 3, 'price' => 7.5 ] ); $c->update( - [ 'age' => 17 ], // criteria - [ '$inc' => [ 'age' => 1 ] ], // update spec - [ 'multiple' => true ] // options: multiple + [ 'generation' => [ '$lte' => 2 ] ], // criteria + [ '$dec' => [ 'price' => 2.0 ] ], // update spec + [ 'multiple' => true ] // options: multiple ); ?>]]></example> </slide>