com presentations: DPC tutorial, with new driver syntax for everything: mongo-dpc16.xml slides/mongodb/aggr-op-group-compound-example.xml slides/mongodb/aggregation-example-cuisine6-sort.xml slides/mongodb/excercise-import-with-types.xml slides/mongodb/excercise03-add-like.xml slides/mongodb/excercise03-push-to-add-review.xml slides/mongodb/excercise03-reviews-example.xml slides/mongodb/excercise05-indexes.xml slides/mongodb/idx-cities-by-name-an
[email protected] (Derick Rethans) Fri, 17 Jun 2016 15:04:23 +0000
| Newsgroups | php.pres |
|---|---|
| Message-ID | <[email protected]> |
Commit: 6a81471a020255d63a055069e29df4c84197afed Author: Derick Rethans <[email protected]> Fri, 17 Jun 2016 16:04:23 +0100 Parents: 1e5ea7e1b8949a2d9524f2c40dd21593d63fda21 Branches: master Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=6a81471a020255d63a055069e29df4c84197afed Log: DPC tutorial, with new driver syntax for everything Changed paths: A mongo-dpc16.xml M slides/mongodb/aggr-op-group-compound-example.xml M slides/mongodb/aggregation-example-cuisine6-sort.xml M slides/mongodb/excercise-import-with-types.xml M slides/mongodb/excercise03-add-like.xml M slides/mongodb/excercise03-push-to-add-review.xml M slides/mongodb/excercise03-reviews-example.xml M slides/mongodb/excercise05-indexes.xml M slides/mongodb/idx-cities-by-name-and-pop2.xml A slides/mongodb/idx-cities-by-name-and-pop2a.xml M slides/mongodb/idx-cities-by-name-and-pop3.xml M slides/mongodb/idx-cities-by-pop-and-dem2.xml M slides/mongodb/idx-cities-by-pop-and-dem4.xml M slides/mongodb/idx-cities-by-pop-and-dem5.xml M slides/mongodb/idx-cities-by-pop-and-dem6.xml A slides/mongodb/idx-cities-covered.xml M slides/mongodb/idx-which-one-is-picked.xml A slides/mongodb/mongodbeurope16.png A slides/mongodb/mongodbeurope16.xml M slides/mongodb/php-connection-string.xml A slides/mongodb/phplib-crud-insert.xml A slides/mongodb/phplib-crud-query-multiple.xml A slides/mongodb/phplib-crud-query-operators.xml A slides/mongodb/phplib-crud-query.xml A slides/mongodb/phplib-crud-remove.xml A slides/mongodb/phplib-crud-update.xml M slides/mongodb/sharding-config-server.xml M slides/mongodb/sharding-connecting.xml M slides/mongodb/types-php.xml M slides/mongodb/types.xml
diff_6a81471a020255d63a055069e29df4c84197afed.txt
(text/plain, 43.7 KB)
diff --git a/mongo-dpc16.xml b/mongo-dpc16.xml new file mode 100644 index 0000000..7a01c6f --- /dev/null +++ b/mongo-dpc16.xml @@ -0,0 +1,226 @@ +<?xml version="1.0" encoding="utf-8"?> +<presentation css="10gen-strict.css"> +<topic>MongoDB</topic> +<title>Modern Databases</title> +<event>DPC 2016</event> +<location>Amsterdam, Netherlands</location> +<date>Jun 23rd, 2016</date> +<speaker>Derick Rethans</speaker> +<email>[email protected]</email> +<twitter>derickr</twitter> +<url>http://derickrethans.nl/talks.html</url> +<joindin>https://joind.in/17519</joindin> +<slide>slides/mongodb/title.xml</slide> +<slide>slides/mongodb/me.xml</slide> +<slide>slides/mongodb/half-tutorial-topics.xml</slide> + +<slide>slides/mongodb/section-intro.xml</slide> + +<!-- From SQL to NoSQL bit --> +<slide>slides/mongodb/relational-model.xml</slide> +<slide>slides/mongodb/normal-form.xml</slide> + +<!-- DIFFERENT NoSQL --> +<slide>slides/mongodb/nosql.xml</slide> +<slide>slides/mongodb/nosql-kv.xml</slide> +<slide>slides/mongodb/nosql-column.xml</slide> +<slide>slides/mongodb/nosql-graph.xml</slide> +<slide>slides/mongodb/nosql-document.xml</slide> +<slide>slides/mongodb/cap.xml</slide> + +<!-- DOCUMENT and MongoDB --> +<slide>slides/mongodb/collections-documents.xml</slide> +<slide>slides/mongodb/document-title.xml</slide> +<slide>slides/mongodb/document-simple.xml</slide> +<slide>slides/mongodb/document-complex.xml</slide> + +<slide>slides/mongodb/collections-title.xml</slide> +<slide>slides/mongodb/collections.xml</slide> + +<slide>slides/mongodb/phplib-title.xml</slide> +<slide>slides/mongodb/new-architecture.xml</slide> +<slide>slides/mongodb/phplib-intro.xml</slide> +<slide>slides/mongodb/phplib-crud-insert.xml</slide> + + +<!-- FIRST EXCERCISE --> +<slide>slides/mongodb/excercise.xml</slide> +<slide>slides/mongodb/excercise-import-untappd.xml</slide> + +<slide>slides/mongodb/phplib-crud-query.xml</slide> +<slide>slides/mongodb/phplib-crud-query-multiple.xml</slide> +<slide>slides/mongodb/phplib-crud-query-operators.xml</slide> + +<!-- SECOND EXCERCISE --> +<slide>slides/mongodb/excercise.xml</slide> +<slide>slides/mongodb/excercise-finding-data.xml</slide> + +<slide>slides/mongodb/types.xml</slide> +<slide>slides/mongodb/types-php.xml</slide> + +<!-- THIRD EXCERCISE --> +<slide>slides/mongodb/excercise.xml</slide> +<slide>slides/mongodb/excercise-import-with-types.xml</slide> + + +<slide>slides/mongodb/phplib-crud-update.xml</slide> +<slide>slides/mongodb/phplib-crud-remove.xml</slide> + +<!-- SCHEMA DESIGN --> +<slide>slides/mongodb/section-schema-design.xml</slide> +Common Patterns + +- RDBMS-normalisation. + +<slide>slides/mongodb/blog.xml</slide> +<slide>slides/mongodb/blog2.xml</slide> +- todo: recreate model/relationship diagrams (e.g. Google Drive's drawing tool) + +<slide>slides/mongodb/considerations.xml</slide> + + +<slide>slides/mongodb/one-to-many1.xml</slide> +<slide>slides/mongodb/one-to-many2.xml</slide> +<slide>slides/mongodb/one-to-many4.xml</slide> +<slide>slides/mongodb/tip-array-key.xml</slide> + +<!-- SECOND EXCERCISE --> +<slide>slides/mongodb/excercise.xml</slide> +<slide>slides/mongodb/excercise02-distillers-storage.xml</slide> +<slide>slides/mongodb/excercise02-distillers-example.xml</slide> + + +<slide>slides/mongodb/embed-vs-link.xml</slide> + + +<!-- THIRD EXCERCISE --> +<slide>slides/mongodb/excercise.xml</slide> +<slide>slides/mongodb/excercise03-reviews.xml</slide> +<slide>slides/mongodb/excercise03-reviews-example.xml</slide> +<slide>slides/mongodb/excercise03-push-to-add-review.xml</slide> +<slide>slides/mongodb/excercise03-add-like.xml</slide> + + +<!-- COMMANDS and AGGREGATION --> +<slide>slides/mongodb/section-aggregation.xml</slide> +<slide>slides/mongodb/aggr-aggr-framework.xml</slide> + +<slide>slides/mongodb/aggr-pipeline.xml</slide> +<slide>slides/mongodb/aggr-pipelines-ops.xml</slide> +<slide>slides/mongodb/aggr-our-example-data.xml</slide> +<slide>slides/mongodb/aggr-op-match.xml</slide> +<slide>slides/mongodb/aggr-op-match-example.xml</slide> +<slide>slides/mongodb/aggr-op-match-with-query-example.xml</slide> +<slide>slides/mongodb/aggr-op-project.xml</slide> +<slide>slides/mongodb/aggr-op-project-incl-excl-example.xml</slide> +<slide>slides/mongodb/aggr-op-project-rename-compute-example.xml</slide> +<slide>slides/mongodb/aggr-op-project-create-sub-example.xml</slide> +<slide>slides/mongodb/aggr-op-group.xml</slide> +<slide>slides/mongodb/aggr-op-group-sum-count-example.xml</slide> +<slide>slides/mongodb/aggr-op-group-collect-example.xml</slide> +<slide>slides/mongodb/aggr-op-group-compound-example.xml</slide> +<slide>slides/mongodb/aggr-op-unwind.xml</slide> +<slide>slides/mongodb/aggr-op-unwind-example.xml</slide> +<slide>slides/mongodb/aggr-op-sort-skip-limit.xml</slide> +<slide>slides/mongodb/aggr-op-sort-example.xml</slide> +<slide>slides/mongodb/aggr-op-limit-example.xml</slide> +<slide>slides/mongodb/aggr-op-skip-example.xml</slide> +<slide>slides/mongodb/aggr-op-sort-limit-skip-example.xml</slide> + +<!-- FOURTH EXCERCISE --> +<slide>slides/mongodb/aggregation-example-cuisine6-sort.xml</slide> +<slide>slides/mongodb/excercise.xml</slide> +<slide>slides/mongodb/excercise04-reviews-aggr.xml</slide> + +<slide>slides/mongodb/questions.xml</slide> + + +<!-- INDEXES --> +<slide>slides/mongodb/section-indexes.xml</slide> + +<slide>slides/mongodb/phplib-index.xml</slide> +<slide>slides/mongodb/idx-create-php.xml</slide> +Add slide about unique indexes. + +<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-pop2a.xml</slide> +<slide>slides/mongodb/idx-cities-by-name-and-pop3.xml</slide> + +<slide>slides/mongodb/excercise.xml</slide> +<slide>slides/mongodb/excercise05-indexes.xml</slide> + +<slide>slides/mongodb/idx-cities-by-pop-and-dem.xml</slide> +<slide>slides/mongodb/idx-cities-by-pop-and-dem2.xml</slide> +- nscanned is index entries scanned, nscannedobjects is documents scanned +- todo: update explain output these for 3.0 +<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-cities-covered.xml</slide> + +<slide>slides/mongodb/idx-recap1.xml</slide> +<slide>slides/mongodb/idx-recap3.xml</slide> + +<slide>slides/mongodb/idx-which-one-is-picked.xml</slide> +- http://docs.mongodb.org/manual/core/query-plans/#query-optimization +<slide>slides/mongodb/questions.xml</slide> + +<!-- REPLICATION --> +<slide>slides/mongodb/section-replication.xml</slide> +<slide>slides/mongodb/repl-use-cases.xml</slide> +<slide>slides/mongodb/repl-features.xml</slide> +<slide>slides/mongodb/repl-works-basic.xml</slide> +<slide>slides/mongodb/repl-works-normal.xml</slide> +<slide>slides/mongodb/repl-works-failover1.xml</slide> +<slide>slides/mongodb/repl-works-failover2.xml</slide> +<slide>slides/mongodb/repl-works-failover3.xml</slide> +<slide>slides/mongodb/repl-works-failover4.xml</slide> +<slide>slides/mongodb/repl-oplog.xml</slide> + +<slide>slides/mongodb/replication-setup.xml</slide> +<slide>slides/mongodb/php-connection-string.xml</slide> +<slide>slides/mongodb/repl-eventual-consistency.xml</slide> + +<!-- SHARDING --> +<slide>slides/mongodb/section-sharding.xml</slide> +<slide>slides/mongodb/sharding-agenda.xml</slide> +<slide>slides/mongodb/sharding-the-story.xml</slide> +<slide>slides/mongodb/sharding-vertical-scale.xml</slide> +<slide>slides/mongodb/sharding-horizontal-scale.xml</slide> +<slide>slides/mongodb/sharding-data-store-old.xml</slide> +<slide>slides/mongodb/sharding-data-store-now.xml</slide> +<slide>slides/mongodb/sharding-why.xml</slide> +<slide>slides/mongodb/sharding-working-set.xml</slide> +<slide>slides/mongodb/sharding-throughput.xml</slide> +<slide>slides/mongodb/sharding-mongo-approach.xml</slide> +<slide>slides/mongodb/sharding-partition.xml</slide> +<slide>slides/mongodb/sharding-chunks.xml</slide> +<slide>slides/mongodb/sharding-manages.xml</slide> +<slide>slides/mongodb/sharding-auto-shard.xml</slide> +<slide>slides/mongodb/sharding-architecture.xml</slide> +<slide>slides/mongodb/sharding-shard.xml</slide> +<slide>slides/mongodb/sharding-config-server.xml</slide> +<slide>slides/mongodb/sharding-mongos-manages.xml</slide> +<slide>slides/mongodb/sharding-infrastructure.xml</slide> +<slide>slides/mongodb/sharding-configuration.xml</slide> + +<slide>slides/mongodb/sharding-shard-key.xml</slide> +<slide>slides/mongodb/sharding-key-considerations.xml</slide> +- hashed shard keys can help with the 512-byte size limitation + +<slide>slides/mongodb/sharding-key-example.xml</slide> +<slide>slides/mongodb/sharding-key-example2.xml</slide> +<slide>slides/mongodb/sharding-connecting.xml</slide> + +<slide>slides/mongodb/sharding-mechanics.xml</slide> +<slide>slides/mongodb/sharding-partitioning.xml</slide> +<slide>slides/mongodb/sharding-chunk-is-range.xml</slide> +<slide>slides/mongodb/sharding-chunk-splitting.xml</slide> +<slide>slides/mongodb/sharding-balancing.xml</slide> + +<slide>slides/mongodb/questions.xml</slide> +<slide>slides/mongodb/mongodbeurope16.xml</slide> +<slide>slides/mongodb/resources.xml</slide> +</presentation> diff --git a/slides/mongodb/aggr-op-group-compound-example.xml b/slides/mongodb/aggr-op-group-compound-example.xml index 977b3b1..5789b7a 100644 --- a/slides/mongodb/aggr-op-group-compound-example.xml +++ b/slides/mongodb/aggr-op-group-compound-example.xml @@ -6,41 +6,41 @@ <td> <example inline="3"> { - "beer_name" : "Sleigh Ride", - "beer_type" : "Cider", - "brewery_country" : "Wales" + "beer_name": "Sleigh Ride", + "beer_type": "Cider", + "brewery_country": "Wales" } { - "beer_name" : "Mulled Cider", - "beer_type" : "Cider", - "brewery_country" : "Wales" + "beer_name": "Mulled Cider", + "beer_type": "Cider", + "brewery_country": "Wales" } { - "beer_name" : "Mulled Cider", - "beer_type" : "Cider", - "brewery_country" : "Wales" + "beer_name": "Mulled Cider", + "beer_type": "Cider", + "brewery_country": "Wales" } { - "beer_name" : "Two Trees", - "beer_type" : "Perry", - "brewery_country" : "Wales" + "beer_name": "Two Trees", + "beer_type": "Perry", + "brewery_country": "Wales" } { - "beer_name" : "Longdon Perry", - "beer_type" : "Perry", - "brewery_country" : "England" + "beer_name": "Longdon Perry", + "beer_type": "Perry", + "brewery_country": "England" } </example> </td> <td> -<blurb class="large">→</blurb> +<blurb>→</blurb> </td> <td> <example inline="3"> { $group: { _id: *{* -* 'country' : '$brewery_country',* -* 'type' : '$beer_type'* +* 'country': '$brewery_country',* +* 'type': '$beer_type'* * }* beers: { *'$addToSet': '$beer_name'* } } } @@ -49,16 +49,16 @@ <example inline="3"> { - "_id" : { "country" : "England", "type" : "Perry" }, - "beers" : [ "Longdon Perry" ] + "_id": { "country": "England", "type": "Perry" }, + "beers": [ "Longdon Perry" ] } { - "_id" : { "country" : "Wales", "type" : "Cider" }, - "beers" : [ "Mulled Cider", "Sleigh Ride" ] + "_id": { "country": "Wales", "type": "Cider" }, + "beers": [ "Mulled Cider", "Sleigh Ride" ] } { - "_id" : { "country" : "Wales", "type" : "Perry" }, - "beers" : [ "Two Trees" ] + "_id": { "country": "Wales", "type": "Perry" }, + "beers": [ "Two Trees" ] } </example> </td></tr></table> diff --git a/slides/mongodb/aggregation-example-cuisine6-sort.xml b/slides/mongodb/aggregation-example-cuisine6-sort.xml index 08a4673..9cc65a7 100644 --- a/slides/mongodb/aggregation-example-cuisine6-sort.xml +++ b/slides/mongodb/aggregation-example-cuisine6-sort.xml @@ -1,19 +1,19 @@ <slide> <title>Aggregation example</title> -<blurb>Find 10 venues with the most distinct beers</blurb> +<blurb>Find 5 venues with the most distinct beers</blurb> <example result="1"><![CDATA[<?php -$m = new MongoClient(); +$m = new \MongoDB\Client(); $res = $m->tutorial->beer->aggregate( [ [ '$match' => [ 'venue_name' => [ '$ne' => null ] ] ], [ '$group' => [ '_id' => [ 'venue' => '$venue_name', 'beer' => '$beer_name' ] ] ], [ '$group' => [ '_id' => '$_id.venue', count => [ '$sum' => 1 ] ] ], [ '$sort' => [ 'count' => -1 ] ], - [ '$limit' => 10 ], + [ '$limit' => 5 ], ] ); -foreach ( $res['result'] as $result ) +foreach ( $res as $result ) { echo $result['_id'], ': ', $result['count'], "\n"; } diff --git a/slides/mongodb/excercise-import-with-types.xml b/slides/mongodb/excercise-import-with-types.xml index 945554c..73b3608 100644 --- a/slides/mongodb/excercise-import-with-types.xml +++ b/slides/mongodb/excercise-import-with-types.xml @@ -5,7 +5,7 @@ <list> <bullet>Import %beer_abv%, %beer_ibu%, %venue_lat%, %venue_lng% and %rating_score% as float.</bullet> - <bullet>Import %created_at% as %MongoDate% object</bullet> + <bullet>Import %created_at% as %\MongoDB\BSON\UTCDateTime% object</bullet> <bullet>Fix the finding script</bullet> </list> </slide> diff --git a/slides/mongodb/excercise03-add-like.xml b/slides/mongodb/excercise03-add-like.xml index 3982fa3..dd52eaa 100644 --- a/slides/mongodb/excercise03-add-like.xml +++ b/slides/mongodb/excercise03-add-like.xml @@ -16,10 +16,9 @@ <div effect="fade-in"> <example><![CDATA[<?php -$m = new MongoClient; -$c = $m->demo->whisky; +$whisky = new (\MongoDB\Client)->demo->whisky; -$c->update( +$whisky->updateOne( [ 'name' => 'Glenfiddich 15', 'notes.user_name' => 'Derick' ], [ '$inc => [ 'notes.$.likes' => 1 ] ] ); diff --git a/slides/mongodb/excercise03-push-to-add-review.xml b/slides/mongodb/excercise03-push-to-add-review.xml index 02b452c..1e4275b 100644 --- a/slides/mongodb/excercise03-push-to-add-review.xml +++ b/slides/mongodb/excercise03-push-to-add-review.xml @@ -8,25 +8,23 @@ user_name: "Derick", date: ISODate("2013-10-02"), note: "Caramel and honey, fruity with some hints of earth", - likes: 17, - rating: 3, + likes: 17, rating: 3, } ] }]]></example> <div effect="fade-in"> <example><![CDATA[<?php -$m = new MongoClient; -$c = $m->demo->whisky; +$whisky = new (\MongoDB\Client)->demo->whisky; $newReview = [ user_name => "Michael", - date => new MongoDate(strtotime("2013-10-01")), + date => new \MongoDB\BSON\UTCDateTime( strtotime("2013-10-01") * 1000 ), note => "No peat, but fruity", rating => 1, ]; -$c->update( +$whisky->updateOne( [ 'name' => 'Glenfiddich 15' ], [ '$push => [ 'notes' => $newReview ] ] ); diff --git a/slides/mongodb/excercise03-reviews-example.xml b/slides/mongodb/excercise03-reviews-example.xml index 03767c9..a6f8869 100644 --- a/slides/mongodb/excercise03-reviews-example.xml +++ b/slides/mongodb/excercise03-reviews-example.xml @@ -19,8 +19,7 @@ whisky_name: "Glenfiddich 15", date: ISODate("2013-10-02"), note: "Caramel and honey, fruity with some hints of earth", - likes: 17, - rating: 3, + likes: 17, rating: 3, }]]></example> </div> diff --git a/slides/mongodb/excercise05-indexes.xml b/slides/mongodb/excercise05-indexes.xml index 6872f90..4450d28 100644 --- a/slides/mongodb/excercise05-indexes.xml +++ b/slides/mongodb/excercise05-indexes.xml @@ -1,7 +1,8 @@ <slide> <title>Exercise: Indexes</title> -<blurb>A common query is to find the ten highest rated beers ordered by %rating_score% first, and %created_at% second.<br/>Write a script to:</blurb> +<blurb>A common query is to find the ten highest rated beers ordered by +%rating_score% first, and %created_at% second.<br/>On the MongoDB shell:</blurb> <list> <bullet>Run the query</bullet> diff --git a/slides/mongodb/idx-cities-by-name-and-pop2.xml b/slides/mongodb/idx-cities-by-name-and-pop2.xml index 4f4887a..b509e3f 100644 --- a/slides/mongodb/idx-cities-by-name-and-pop2.xml +++ b/slides/mongodb/idx-cities-by-name-and-pop2.xml @@ -2,25 +2,218 @@ <title>Let's look at the query plan</title> <example inline="1"> -db.cities.find( { country_code: 'GB', population: { $gte: 500000 } } ).*explain()*; +db.cities + .find( { country_code: 'GB', population: { $gte: 500000 } } ) + .*explain("executionStats)*; </example> <example inline="1"> { - "cursor" : "*BtreeCursor country_code_1_population_1*", - |00aa00|"nscanned" : 4,| - |00aa00|"nscannedObjects" : 4,| - |00aa00|"n" : 4,| - "nscannedObjectsAllPlans" : 9, - "nscannedAllPlans" : 10, - "millis" : 0, - "nYields" : 0, - "nChunkSkips" : 0, - "isMultiKey" : false, - "indexOnly" : false, - "indexBounds" : { - "country_code" : [ [ "GB", "GB" ] ], - "population" : [ [ 500000, Infinity ] ] - } + "queryPlanner" : { + "plannerVersion" : 1, + "namespace" : "demo.cities", + "indexFilterSet" : false, + "parsedQuery" : { + "$and" : [ + { + "country_code" : { + "$eq" : "GB" + } + }, + { + "population" : { + "$gte" : 500000 + } + } + ] + }, + "winningPlan" : { + "stage" : "FETCH", + "inputStage" : { + "stage" : "IXSCAN", + "keyPattern" : { + "country_code" : 1, + "population" : 1 + }, + "indexName" : "country_code_1_population_1", + "isMultiKey" : false, + "isUnique" : false, + "isSparse" : false, + "isPartial" : false, + "indexVersion" : 1, + "direction" : "forward", + "indexBounds" : { + "country_code" : [ + "[\"GB\", \"GB\"]" + ], + "population" : [ + "[500000.0, inf.0]" + ] + } + } + }, + "rejectedPlans" : [ + { + "stage" : "FETCH", + "filter" : { + "country_code" : { + "$eq" : "GB" + } + }, + "inputStage" : { + "stage" : "IXSCAN", + "keyPattern" : { + "population" : 1, + "elevation" : 1 + }, + "indexName" : "population_1_elevation_1", + "isMultiKey" : false, + "isUnique" : false, + "isSparse" : false, + "isPartial" : false, + "indexVersion" : 1, + "direction" : "forward", + "indexBounds" : { + "population" : [ + "[500000.0, inf.0]" + ], + "elevation" : [ + "[MinKey, MaxKey]" + ] + } + } + }, + { + "stage" : "FETCH", + "filter" : { + "country_code" : { + "$eq" : "GB" + } + }, + "inputStage" : { + "stage" : "IXSCAN", + "keyPattern" : { + "population" : 1, + "dem" : 1 + }, + "indexName" : "population_1_dem_1", + "isMultiKey" : false, + "isUnique" : false, + "isSparse" : false, + "isPartial" : false, + "indexVersion" : 1, + "direction" : "forward", + "indexBounds" : { + "population" : [ + "[500000.0, inf.0]" + ], + "dem" : [ + "[MinKey, MaxKey]" + ] + } + } + }, + { + "stage" : "FETCH", + "filter" : { + "population" : { + "$gte" : 500000 + } + }, + "inputStage" : { + "stage" : "IXSCAN", + "keyPattern" : { + "country_code" : 1, + "timezone" : 1, + "asciiname" : 1 + }, + "indexName" : "country_code_1_timezone_1_asciiname_1", + "isMultiKey" : false, + "isUnique" : false, + "isSparse" : false, + "isPartial" : false, + "indexVersion" : 1, + "direction" : "forward", + "indexBounds" : { + "country_code" : [ + "[\"GB\", \"GB\"]" + ], + "timezone" : [ + "[MinKey, MaxKey]" + ], + "asciiname" : [ + "[MinKey, MaxKey]" + ] + } + } + } + ] + }, + "executionStats" : { + "executionSuccess" : true, + "nReturned" : 4, + "executionTimeMillis" : 12, + "totalKeysExamined" : 4, + "totalDocsExamined" : 4, + "executionStages" : { + "stage" : "FETCH", + "nReturned" : 4, + "executionTimeMillisEstimate" : 10, + "works" : 7, + "advanced" : 4, + "needTime" : 0, + "needYield" : 1, + "saveState" : 6, + "restoreState" : 6, + "isEOF" : 1, + "invalidates" : 0, + "docsExamined" : 4, + "alreadyHasObj" : 0, + "inputStage" : { + "stage" : "IXSCAN", + "nReturned" : 4, + "executionTimeMillisEstimate" : 10, + "works" : 5, + "advanced" : 4, + "needTime" : 0, + "needYield" : 0, + "saveState" : 6, + "restoreState" : 6, + "isEOF" : 1, + "invalidates" : 0, + "keyPattern" : { + "country_code" : 1, + "population" : 1 + }, + "indexName" : "country_code_1_population_1", + "isMultiKey" : false, + "isUnique" : false, + "isSparse" : false, + "isPartial" : false, + "indexVersion" : 1, + "direction" : "forward", + "indexBounds" : { + "country_code" : [ + "[\"GB\", \"GB\"]" + ], + "population" : [ + "[500000.0, inf.0]" + ] + }, + "keysExamined" : 4, + "seeks" : 1, + "dupsTested" : 0, + "dupsDropped" : 0, + "seenInvalidated" : 0 + } + } + }, + "serverInfo" : { + "host" : "whisky", + "port" : 27017, + "version" : "3.3.8", + "gitVersion" : "00ed8f3b275971093ddd2ee7d3ab558904e28af0" + }, + "ok" : 1 } </example> <example> diff --git a/slides/mongodb/idx-cities-by-name-and-pop2a.xml b/slides/mongodb/idx-cities-by-name-and-pop2a.xml new file mode 100644 index 0000000..aeab3fb --- /dev/null +++ b/slides/mongodb/idx-cities-by-name-and-pop2a.xml @@ -0,0 +1,107 @@ +<slide> +<title>Let's look at the query plan</title> + +<div effect="fade-out"> +<example inline="1"> +db.cities + .find( { country_code: 'GB', population: { $gte: 500000 } } ) + .*explain("executionStats)*; +</example> +</div> + +<div effect="fade-in-out"> +<blurb>Some stats about the query itself:</blurb> +<example inline="1"> +{ + "queryPlanner" : { + "plannerVersion" : 1, + "namespace" : "demo.cities", + "indexFilterSet" : false, + "parsedQuery" : { + "$and" : [ + { + "country_code" : { + "$eq" : "GB" + } + }, + { + "population" : { + "$gte" : 500000 + } + } + ] + }, +</example> +</div> +<div effect="fade-in-out"> +<blurb>The chosen query plan:</blurb> +<example inline="1"> + "winningPlan" : { + *"stage" : "FETCH",* + "inputStage" : { + *"stage" : "IXSCAN",* + *"keyPattern" : { "country_code" : 1, "population" : 1 },* + "indexName" : *"country_code_1_population_1",* + "isMultiKey" : false, + "isUnique" : false, + "isSparse" : false, + "isPartial" : false, + "indexVersion" : 1, + *"direction" : "forward",* + "indexBounds" : { + "country_code" : [ "[\"GB\", \"GB\"]" ], + "population" : [ "[500000.0, inf.0]" ] + } + } + }, +</example> +</div> +<div effect="fade-in-out"> +<blurb>All the other considered plans:</blurb> +<example inline="1"> + "rejectedPlans" : [ ... ] + }, +</example> +</div> +<div effect="fade-in-out"> +<blurb>Statistics from the execution:</blurb> +<example inline="1"> + "executionStats" : { + *"nReturned" : 4,* + "executionTimeMillis" : 12, + *"totalKeysExamined" : 4,* + *"totalDocsExamined" : 4,* + "executionStages" : { + "stage" : "FETCH", + *"nReturned" : 4,* + "executionTimeMillisEstimate" : 10, + "inputStage" : { + "stage" : "IXSCAN", + *"nReturned" : 4,* + "executionTimeMillisEstimate" : 10, + "direction" : "forward", + "indexBounds" : { + "country_code" : [ "[\"GB\", \"GB\"]" ], + "population" : [ "[500000.0, inf.0]" ] + }, + *"keysExamined" : 4,* + } + } + }, +</example> +</div> +<div effect="fade-in-out"> +<blurb>And some server info:</blurb> +<example> + "serverInfo" : { + "host" : "whisky", + "port" : 27017, + "version" : "3.3.8", + "gitVersion" : "00ed8f3b275971093ddd2ee7d3ab558904e28af0" + }, + "ok" : 1 +} +</example> +</div> + +</slide> diff --git a/slides/mongodb/idx-cities-by-name-and-pop3.xml b/slides/mongodb/idx-cities-by-name-and-pop3.xml index f65b11a..2c5ebef 100644 --- a/slides/mongodb/idx-cities-by-name-and-pop3.xml +++ b/slides/mongodb/idx-cities-by-name-and-pop3.xml @@ -3,23 +3,26 @@ <example inline="1"> db.cities.find( { country_code: 'GB', population: { $gte: 500000 } } ) - .sort( { population: -1 }).explain(); + *.sort( { population: -1 })*.explain(); </example> <example inline="1"> { - "cursor" : "BtreeCursor country_code_1_population_1 ~*reverse*~", - "nscanned" : 4, - "nscannedObjects" : 4, - "n" : 4, - "nscannedObjectsAllPlans" : 9, - "nscannedAllPlans" : 10, - "millis" : 0, - "isMultiKey" : false, - "indexOnly" : false, - "indexBounds" : { - "country_code" : [ [ "GB", "GB" ] ], - "population" : [ [ ~*Infinity, 500000*~ ] ] - } + "stage" : "FETCH", + "inputStage" : { + "stage" : "IXSCAN", + "keyPattern" : { "country_code" : 1, "population" : 1 }, + "indexName" : "country_code_1_population_1", + "isMultiKey" : false, + "isUnique" : false, + "isSparse" : false, + "isPartial" : false, + "indexVersion" : 1, + "direction" : *"backward",* + "indexBounds" : { + "country_code" : [ "[\"GB\", \"GB\"]" ], + "population" : [ "[inf.0, 500000.0]" ] + } + } } </example> <example> diff --git a/slides/mongodb/idx-cities-by-pop-and-dem2.xml b/slides/mongodb/idx-cities-by-pop-and-dem2.xml index 7bfe140..98ff58d 100644 --- a/slides/mongodb/idx-cities-by-pop-and-dem2.xml +++ b/slides/mongodb/idx-cities-by-pop-and-dem2.xml @@ -2,32 +2,32 @@ <title>Let's look at the query plan</title> <example inline="1"> -db.cities.find( { population: { $gte: 2000000 }, elevation: { $gte: 1654 } } ).explain(); +db.cities + .find( { population: { $gte: 2000000 }, elevation: { $gte: 1654 } } ) + .explain("executionStats"); </example> <example inline="1"> -{ - "cursor" : "BtreeCursor population_1_elevation_1", - |ff8000|"nscanned" : 131,| - |00cc00|"nscannedObjects" : 6,| - |00cc00|"n" : 6,| - "nscannedObjectsAllPlans" : 6, - "nscannedAllPlans" : 131, - "millis" : 3, - "isMultiKey" : false, - "indexOnly" : false, - "indexBounds" : { - "population" : [ [ 2000000, Infinity ] ], - "elevation" : [ [ 1654, Infinity ] ] - } -} -</example> -<example> -{ "name" : "Johannesburg", "population" : 2026469, "elevation" : 1767 } -{ "name" : "Nairobi", "population" : 2750547, "elevation" : 1684 } -{ "name" : "Addis Ababa", "population" : 2757729, "elevation" : 2405 } -{ "name" : "Kabul", "population" : 3043532, "elevation" : 1798 } -{ "name" : "Bogotá", "population" : 7102602, "elevation" : 2582 } -{ "name" : "Mexico City", "population" : 12294193, "elevation" : 2240 } +"executionStats" : { + *"nReturned" : 6,* + "totalKeysExamined" : 131, + "totalDocsExamined" : 6, + "executionStages" : { + "stage" : *"PROJECTION",* + *"nReturned" : 6,* + "executionTimeMillisEstimate" : 0, + *"transformBy" : { "_id" : 0, "name" : 1, "population" : 1, "elevation" : 1 },* + "inputStage" : { + "stage" : "FETCH", + *"nReturned" : 6,* + "inputStage" : { + "stage" : "IXSCAN", + *"nReturned" : 6,* + "indexName" : "population_1_elevation_1", + *"keysExamined" : 131,* + } + } + } +}, </example> </slide> diff --git a/slides/mongodb/idx-cities-by-pop-and-dem4.xml b/slides/mongodb/idx-cities-by-pop-and-dem4.xml index 0d8ada8..315680e 100644 --- a/slides/mongodb/idx-cities-by-pop-and-dem4.xml +++ b/slides/mongodb/idx-cities-by-pop-and-dem4.xml @@ -6,14 +6,20 @@ db.cities.find( { population: { $gte: 2000000 }, elevation: { $gte : 1654 } } ) .sort( { elevation: -1 } ).explain(); </example> <example inline="1"> -{ - "cursor" : "BtreeCursor population_1_elevation_1", - "nscanned" : 127, - "nscannedObjects" : 6, - "n" : 6, - *|f10000|"scanAndOrder" : true,|* - "millis" : 1, -... +"winningPlan" : { + *"stage" : "SORT",* + "sortPattern" : { "elevation" : -1 }, + "inputStage" : { + "stage" : "SORT_KEY_GENERATOR", + "inputStage" : { + "stage" : "FETCH", + "inputStage" : { + "stage" : "IXSCAN", + "keyPattern" : { "population" : 1, "elevation" : 1 }, + } + } + } +}, </example> <list> diff --git a/slides/mongodb/idx-cities-by-pop-and-dem5.xml b/slides/mongodb/idx-cities-by-pop-and-dem5.xml index 8ac84aa..2ccd00b 100644 --- a/slides/mongodb/idx-cities-by-pop-and-dem5.xml +++ b/slides/mongodb/idx-cities-by-pop-and-dem5.xml @@ -7,14 +7,20 @@ db.cities.find( { population: { $gte: 2000000 }, elevation: { $gte : 1654 } } ) .sort( { elevation: -1 } ).explain(); </example> <example inline="1"> -{ - *|f10000|"cursor" : "BtreeCursor population_1_elevation_1",|* - "nscanned" : 127, - "nscannedObjects" : 6, - "n" : 6, - *|f10000|"scanAndOrder" : true,|* - "millis" : 1, -... +"winningPlan" : { + *"stage" : "SORT",* + "sortPattern" : { "elevation" : -1 }, + "inputStage" : { + "stage" : "SORT_KEY_GENERATOR", + "inputStage" : { + "stage" : "FETCH", + "inputStage" : { + "stage" : "IXSCAN", + "keyPattern" : { "population" : 1, "elevation" : 1 }, + } + } + } +}, </example> <div effect="fade-in"> <blurb>In most cases, MongoDB can only use one index at the same time.</blurb> diff --git a/slides/mongodb/idx-cities-by-pop-and-dem6.xml b/slides/mongodb/idx-cities-by-pop-and-dem6.xml index 7f66f93..abb1ada 100644 --- a/slides/mongodb/idx-cities-by-pop-and-dem6.xml +++ b/slides/mongodb/idx-cities-by-pop-and-dem6.xml @@ -5,19 +5,15 @@ db.cities.find( { elevation: { $gte : 1654 } } ).explain(); </example> <example inline="1"> -{ - *|f10000|"cursor" : "BasicCursor",|* - "nscanned" : 22840, - "nscannedObjects" : 22840, - "n" : 614, - "millis" : 26, - "nYields" : 0, - "nChunkSkips" : 0, - "isMultiKey" : false, - "indexOnly" : false, - "indexBounds" : { - } -} +"winningPlan" : { + *"stage" : "COLLSCAN",* + "filter" : { + "elevation" : { + "$gte" : 1654 + } + }, + "direction" : "forward" +}, </example> <div effect="fade-in"> <break/> diff --git a/slides/mongodb/idx-cities-covered.xml b/slides/mongodb/idx-cities-covered.xml new file mode 100644 index 0000000..caa4f41 --- /dev/null +++ b/slides/mongodb/idx-cities-covered.xml @@ -0,0 +1,35 @@ +<slide> +<title>Covered queries</title> + +<example inline="1"> +db.cities.find( + { population: { $gte: 2000000 }, elevation: { $gte : 1654 } } + ).explain(); +</example> +<example inline="1"> +"winningPlan" : { + *"stage" : "FETCH",* + "inputStage" : { + "stage" : "IXSCAN", + "keyPattern" : { "population" : 1, "elevation" : 1 }, + } +}, +</example> +<blurb>vs.</blurb> +<example inline="1"> +db.cities.find( + { population: { $gte: 2000000 }, elevation: { $gte : 1654 } }, + { _id: 0, population: 1, elevation: 1 } + ).explain(); +</example> +<example inline="1"> +"winningPlan" : { + *"stage" : "PROJECTION",* + "transformBy" : { "_id" : 0, "population" : 1, "elevation" : 1 }, + "inputStage" : { + "stage" : "IXSCAN", + "keyPattern" : { "population" : 1, "elevation" : 1 }, + } +}, +</example> +</slide> diff --git a/slides/mongodb/idx-which-one-is-picked.xml b/slides/mongodb/idx-which-one-is-picked.xml index 3235120..d1fdd31 100644 --- a/slides/mongodb/idx-which-one-is-picked.xml +++ b/slides/mongodb/idx-which-one-is-picked.xml @@ -13,15 +13,6 @@ db.cities.createIndex( { elevation: -1 } ); db.cities.find( { population: { $gte: 2000000 }, elevation: { $gte : 1654 } }) .sort( { elevation: -1 } ) .hint( { elevation: -1 } );</example> -<example inline="1"> -{ - *"cursor" : "BtreeCursor elevation_-1",* - *|ff8000|"nscanned" : 614,|* - "nscannedObjects" : 614, - "n" : 6, - "millis" : 2, -... -</example> </bullet> </list> </slide> diff --git a/slides/mongodb/mongodbeurope16.png b/slides/mongodb/mongodbeurope16.png new file mode 100644 index 0000000..1060dbf Binary files /dev/null and b/slides/mongodb/mongodbeurope16.png differ diff --git a/slides/mongodb/mongodbeurope16.xml b/slides/mongodb/mongodbeurope16.xml new file mode 100644 index 0000000..d207628 --- /dev/null +++ b/slides/mongodb/mongodbeurope16.xml @@ -0,0 +1,5 @@ +<slide style="black"> + +<image align="center" filename="mongodbeurope16.png"/> +<blurb align="center">Get 20\% off with code "%derickrethans20%"</blurb> +</slide> diff --git a/slides/mongodb/php-connection-string.xml b/slides/mongodb/php-connection-string.xml index cdfe9e2..1be50f3 100644 --- a/slides/mongodb/php-connection-string.xml +++ b/slides/mongodb/php-connection-string.xml @@ -4,17 +4,16 @@ <example result="0"><![CDATA[<?php $options = [ 'replicaSet' => 'seta' ]; -$m = new MongoClient( 'mongodb://localhost:13000/?replicaSet=seta' ); +$m = new \MongoDB\Client( 'mongodb://localhost:13000/?replicaSet=seta' ); -$m = new MongoClient( 'mongodb://localhost:13000,localhost:13001', $options ); +$m = new \MongoDB\Client( 'mongodb://localhost:13000,localhost:13001', $options ); -$m = new MongoClient( 'mongodb://user:password@localhost:13000/demo', $options ); +$m = new \MongoDB\Client( 'mongodb://user:password@localhost:13000/demo', $options ); ?>]]></example> <list> - <bullet>Add more than one host for seeding</bullet> + <bullet>Add more than one host for seeding (a majority)</bullet> <bullet>Don't add the arbiters to the connection string</bullet> - <bullet>Don't use %->authenticate()%</bullet> </list> </slide> diff --git a/slides/mongodb/phplib-crud-insert.xml b/slides/mongodb/phplib-crud-insert.xml new file mode 100644 index 0000000..223f652 --- /dev/null +++ b/slides/mongodb/phplib-crud-insert.xml @@ -0,0 +1,26 @@ +<slide> +<title>MongoDB & PHP: CRUD (Create)</title> + +<example inline="1"><![CDATA[<?php +require 'vendor/autoload.php'; + +$whiskies = (new \MongoDB\Client)->dramio->whisky; + +$doc1 = [ + "slug" => "ancnoc", + "name" => "anCnoc", + "region_slug" => "scotland-highlands", +]; +$doc2 = [ + "slug" => "ardmore", + "name" => "Ardmore", + "region_slug" => "scotland-speyside", +]; + +// Insert one document: +$whiskies->*insertOne*( $doc1 ); + +// Insert multiple documents: +$whiskies->*insertMany*( [ $doc1, $doc2 ] ); +?>]]></example> +</slide> diff --git a/slides/mongodb/phplib-crud-query-multiple.xml b/slides/mongodb/phplib-crud-query-multiple.xml new file mode 100644 index 0000000..dbccf7c --- /dev/null +++ b/slides/mongodb/phplib-crud-query-multiple.xml @@ -0,0 +1,21 @@ +<slide> +<title>MongoDB & PHP: Query</title> + +<example inline="1"><![CDATA[<?php +require 'vendor/autoload.php'; +$whiskies = (new MongoDB\Client)->dramio->whisky; + +// Find multiple documents: +$cursor = $whiskies->*find*( [ 'style_slug' => 'single-cask' ] ); + +// Find multiple documents, with *sort*, *skip* over 5, and *limit* to 5: +$cursor = $whiskies->find( + [ 'style_slug' => 'single-cask' ], + [ + 'projection' => [ '_id' => 0, 'name' => 1, 'region' => 1 ], + *'sort'* => [ 'name' => 1 ], + *'skip'* => 5, + *'limit'* => 5, + ] +);]]></example> +</slide> diff --git a/slides/mongodb/phplib-crud-query-operators.xml b/slides/mongodb/phplib-crud-query-operators.xml new file mode 100644 index 0000000..db79d8e --- /dev/null +++ b/slides/mongodb/phplib-crud-query-operators.xml @@ -0,0 +1,25 @@ +<slide> +<title>MongoDB & PHP: Query Operators</title> + +<example inline="1"><![CDATA[<?php +require 'vendor/autoload.php'; +$checkins = (new MongoDB\Client)->dramio->whisky; + +// Find checkins with a rating *greater than or equal to 3*: +$cursor = $checkins->find( [ 'rating' => [ *'$gte' => 3* ] ); + +// Find checkins with a rating *less than 4*, *or* *not* for a *single cask* whisky: +$cursor = $checkins->find( [ *'$or'* => [ + [ 'rating' => [ *'$lt' => 4* ], + [ 'style' => [ *'$ne'* => 'single-cask'] ], +] ] ); + +// Find checkins where the *description field exists* +$cursor = $checkins->find( [ 'description' => [ *'$exists' => true* ] ); + +// Find checkins where the region is an element *in* the array +$cursor = $checkins->find( [ 'region_slug' => [ + *'$in' => [ 'scotland-speyside', 'scotland-highlands' ]* +] ] ); +?>]]></example> +</slide> diff --git a/slides/mongodb/phplib-crud-query.xml b/slides/mongodb/phplib-crud-query.xml new file mode 100644 index 0000000..004162a --- /dev/null +++ b/slides/mongodb/phplib-crud-query.xml @@ -0,0 +1,21 @@ +<slide> +<title>MongoDB & PHP: Query</title> + +<example inline="1"><![CDATA[<?php +require 'vendor/autoload.php'; +$whiskies = (new MongoDB\Client)->dramio->whisky; + +// Find one document: +$whisky = $whiskies->*findOne*( [ 'name' => 'Cambus 26' ] ); + +// Find one document, using a nested field: +$whisky = $whiskies->findOne( [ *'date_time.month'* => 4 ] ); + +// Find one document, but only show some fields: +$whisky = $whiskies->findOne( + [ 'name' => 'Cambus 26' ], // query + [ + *'projection' => [ '_id' => 0, 'name' => 1, 'region' => 1 ],* + ] +);]]></example> +</slide> diff --git a/slides/mongodb/phplib-crud-remove.xml b/slides/mongodb/phplib-crud-remove.xml new file mode 100644 index 0000000..cd32b6b --- /dev/null +++ b/slides/mongodb/phplib-crud-remove.xml @@ -0,0 +1,15 @@ +<slide> +<title>MongoDB & PHP: Remove</title> + +<example inline="1"><![CDATA[<?php +require 'vendor/autoload.php'; + +$whiskies = (new MongoDB\Client)->dramio->whisky; + +// Remove document: +$whiskies->*deleteOne*( [ 'name' => 'Jack Daniels' ] ); + +// Remove multiple documents: +$whiskies->*deleteMany*( [ 'style_slug' => 'blended-grain' ] ); +?>]]></example> +</slide> diff --git a/slides/mongodb/phplib-crud-update.xml b/slides/mongodb/phplib-crud-update.xml new file mode 100644 index 0000000..1e45a9d --- /dev/null +++ b/slides/mongodb/phplib-crud-update.xml @@ -0,0 +1,27 @@ +<slide> +<title>MongoDB & PHP: Update</title> + +<example inline="1"><![CDATA[<?php +require 'vendor/autoload.php'; + +$whiskies = (new MongoDB\Client)->dramio->whisky; + +// Update *one* document: +$whiskies->*updateOne*( + [ 'slug' => 'cambus-26' ], + [ *'$set'* => [ 'age' => 26 ] ] +); + +// Update *multiple* documents: +$whiskies->*updateMany*( + [ 'region_slug' => 'scotland-highlands' ], + [ '$set' => [ 'region_slug' => 'Scotland, Highlands' ] ] +); + +// Update one document, and push an element to an array: +$whiskies->updateOne( + [ 'slug' => 'suntory-hibiki-12' ], + [ *'$addToSet'* => [ 'tags' => 'japanese' ] ] +); +?>]]></example> +</slide> diff --git a/slides/mongodb/sharding-config-server.xml b/slides/mongodb/sharding-config-server.xml index 7b27afd..07d4233 100644 --- a/slides/mongodb/sharding-config-server.xml +++ b/slides/mongodb/sharding-config-server.xml @@ -7,7 +7,7 @@ <list> <bullet>Stores cluster chunk ranges and locations</bullet> <bullet>Can have only 1 or 3 (production must have 3)</bullet> - <bullet>Two-phase commit (not a replica set)</bullet> + <bullet>A Replica Set</bullet> </list> </bullet> </list> diff --git a/slides/mongodb/sharding-connecting.xml b/slides/mongodb/sharding-connecting.xml index 571ab59..14ecf4a 100644 --- a/slides/mongodb/sharding-connecting.xml +++ b/slides/mongodb/sharding-connecting.xml @@ -2,17 +2,16 @@ <title>Connection String</title> <example result="0"><![CDATA[<?php -$m = new MongoClient( 'mongodb://localhost:27019' ); +$m = new \MongoDB\Client( 'mongodb://localhost:27019' ); -$m = new MongoClient( 'mongodb://localhost:27019,example.com:27019' ); +$m = new \MongoDB\Client( 'mongodb://localhost:27019,example.com:27019' ); -$m = new MongoClient( 'mongodb://user:password@localhost:27019/demo', $options ); +$m = new \MongoDB\Client( 'mongodb://user:password@localhost:27019/demo', $options ); ?>]]></example> <list> <bullet>Remember: mongos may be run on the app server</bullet> <bullet>Add multiple hosts for redundancy</bullet> - <bullet>Don't use %->authenticate()%</bullet> </list> </slide> diff --git a/slides/mongodb/types-php.xml b/slides/mongodb/types-php.xml index 6295458..be93a25 100644 --- a/slides/mongodb/types-php.xml +++ b/slides/mongodb/types-php.xml @@ -3,8 +3,7 @@ <list> <bullet>Unlike PHP, MongoDB does not type juggle</bullet> - <bullet>There is a date type, but it is only a Unix timestamp</bullet> - <bullet>When retrieving data, documents will be returned as an - (associative) array, but never as an object</bullet> + <bullet>There is a date type (%\MongoDB\BSON\UTCDateTime%), but it is only a Unix timestamp</bullet> + <bullet>For *root documents*, *nested documents* and *arrays* you can configure the data type to encapsulate the information</bullet> </list> </slide> diff --git a/slides/mongodb/types.xml b/slides/mongodb/types.xml index c5768c1..95f8854 100644 --- a/slides/mongodb/types.xml +++ b/slides/mongodb/types.xml @@ -2,15 +2,14 @@ <title>MongoDB supports many types</title> <list> - <bullet>null</bullet> <bullet>boolean</bullet> - <bullet>integer (32 and 64-bit, MongoInt32, MongoInt64)</bullet> + <bullet>integer (32 and 64-bit)</bullet> <bullet>double</bullet> <bullet>string (UTF-8)</bullet> <bullet>array</bullet> <bullet>document (associative array in PHP)</bullet> - <bullet>ObjectIDs (MongoId)</bullet> - <bullet>UTC date (MongoDate)</bullet> - <bullet>Binary data (MongoBinData)</bullet> + <bullet>ObjectIDs (%\MongoDB\BSON\ObjectID%)</bullet> + <bullet>UTC date (%\MongoDB\BSON\UTCDateTime%)</bullet> + <bullet>Binary data (%\MongoDB\BSON\Binary%)</bullet> </list> </slide>