com presentations: MongoDB UG Aggregation Talk - now with beer!: mongo-aggr-beer-ldn.xml slides/mongodb/aggr-closest-pub-result.xml slides/mongodb/aggr-closest-pub.xml slides/mongodb/aggr-facet-result.xml slides/mongodb/aggr-facet.xml slides/mongodb/aggr-favourite-beer-result.xml slides/mongodb/aggr-favourite-beer.xml slides/mongodb/aggr-favourite-german-beer-result.xml slides/mongodb/aggr-favourite-german-beer.xml slides/mongodb/aggr-five-stouts

[email protected] (Derick Rethans) Thu, 24 Nov 2016 15:42:38 +0000
Newsgroups php.pres
Message-ID <[email protected]>
Commit:    b5d4863a48ab0ab1e58e17bce38a96d0509c780d
Author:    Derick Rethans <[email protected]>         Thu, 24 Nov 2016 15:42:38 +0000
Parents:   5a0df70360885d604991c403f2c0f4f80fbbe2fd
Branches:  master

Link:       http://git.php.net/?p=presentations.git;a=commitdiff;h=b5d4863a48ab0ab1e58e17bce38a96d0509c780d

Log:
MongoDB UG Aggregation Talk - now with beer!

Changed paths:
  A  mongo-aggr-beer-ldn.xml
  A  slides/mongodb/aggr-closest-pub-result.xml
  A  slides/mongodb/aggr-closest-pub.xml
  A  slides/mongodb/aggr-facet-result.xml
  A  slides/mongodb/aggr-facet.xml
  A  slides/mongodb/aggr-favourite-beer-result.xml
  A  slides/mongodb/aggr-favourite-beer.xml
  A  slides/mongodb/aggr-favourite-german-beer-result.xml
  A  slides/mongodb/aggr-favourite-german-beer.xml
  A  slides/mongodb/aggr-five-stouts-result.xml
  A  slides/mongodb/aggr-five-stouts.xml
  A  slides/mongodb/aggr-ibu-histogram-result-1-2-5.xml
  A  slides/mongodb/aggr-ibu-histogram-result-powersof2.xml
  A  slides/mongodb/aggr-ibu-histogram-result.xml
  A  slides/mongodb/aggr-ibu-histogram.xml
  A  slides/mongodb/aggr-most-in-a-day-result.xml
  A  slides/mongodb/aggr-most-in-a-day.xml
  A  slides/mongodb/aggr-most-style.xml
  M  slides/mongodb/aggr-our-example-data.xml
  M  slides/mongodb/aggr-pipelines-ops.xml
  A  slides/mongodb/aggr-strongest-beer-result.xml
  A  slides/mongodb/aggr-strongest-beer.xml
  A  slides/mongodb/aggr-which-country-most-distinct-result-step1.xml
  A  slides/mongodb/aggr-which-country-most-distinct-result-step2.xml
  A  slides/mongodb/aggr-which-country-most-distinct-result-step3.xml
  A  slides/mongodb/aggr-which-country-most-distinct-result-step4.xml
  A  slides/mongodb/aggr-which-country-most-distinct-result.xml
  A  slides/mongodb/aggr-which-country-most-distinct.xml
  A  slides/mongodb/aggr-which-venue-result.xml
  A  slides/mongodb/aggr-which-venue.xml
  A  slides/mongodb/beer-questions.xml
  A  slides/mongodb/i-like-beer.xml
  A  slides/mongodb/untappd1.png
diff_b5d4863a48ab0ab1e58e17bce38a96d0509c780d.txt (text/plain, 34.2 KB)
diff --git a/mongo-aggr-beer-ldn.xml b/mongo-aggr-beer-ldn.xml
new file mode 100644
index 0000000..8b67943
--- /dev/null
+++ b/mongo-aggr-beer-ldn.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<presentation css="10gen-strict.css">
+<topic>MongoDB</topic>
+<title>Adventures in Aggregating Beer</title>
+<event>DPC 2016</event>
+<location>Amsterdam, Netherlands</location>
+<date>Nov 24th, 2016</date>
+<speaker>Derick Rethans</speaker>
+<email>[email protected]</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/i-like-beer.xml</slide>
+<slide>slides/mongodb/beer-questions.xml</slide>
+
+<slide>slides/mongodb/aggr-our-example-data.xml</slide>
+
+<slide>slides/mongodb/aggr-aggr-framework-img.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-favourite-beer.xml</slide>
+<slide>slides/mongodb/aggr-favourite-beer-result.xml</slide>
+
+<slide>slides/mongodb/aggr-favourite-german-beer.xml</slide>
+<slide>slides/mongodb/aggr-favourite-german-beer-result.xml</slide>
+
+<slide>slides/mongodb/aggr-strongest-beer.xml</slide>
+<slide>slides/mongodb/aggr-strongest-beer-result.xml</slide>
+
+<slide>slides/mongodb/aggr-which-venue.xml</slide>
+<slide>slides/mongodb/aggr-which-venue-result.xml</slide>
+
+<slide>slides/mongodb/aggr-which-country-most-distinct.xml</slide>
+
+<slide>slides/mongodb/aggr-which-country-most-distinct-result-step1.xml</slide>
+<slide>slides/mongodb/aggr-which-country-most-distinct-result-step2.xml</slide>
+<slide>slides/mongodb/aggr-which-country-most-distinct-result-step3.xml</slide>
+<slide>slides/mongodb/aggr-which-country-most-distinct-result-step4.xml</slide>
+
+<slide>slides/mongodb/aggr-closest-pub.xml</slide>
+<slide>slides/mongodb/aggr-closest-pub-result.xml</slide>
+
+<slide>slides/mongodb/aggr-most-style.xml</slide>
+
+<slide>slides/mongodb/aggr-ibu-histogram.xml</slide>
+<slide>slides/mongodb/aggr-ibu-histogram-result.xml</slide>
+<slide>slides/mongodb/aggr-ibu-histogram-result-1-2-5.xml</slide>
+<slide>slides/mongodb/aggr-ibu-histogram-result-powersof2.xml</slide>
+
+<slide>slides/mongodb/aggr-facet.xml</slide>
+<slide>slides/mongodb/aggr-facet-result.xml</slide>
+
+<slide>slides/mongodb/questions.xml</slide>
+<slide>slides/mongodb/resources.xml</slide>
+</presentation>
diff --git a/slides/mongodb/aggr-closest-pub-result.xml b/slides/mongodb/aggr-closest-pub-result.xml
new file mode 100644
index 0000000..55fb32d
--- /dev/null
+++ b/slides/mongodb/aggr-closest-pub-result.xml
@@ -0,0 +1,30 @@
+<slide>
+<title>What is the ~closet pub~ for ~x~ beer?</title>
+
+<example inline="1">db.beer.aggregate( [
+    { $geoNear: {
+        near: { type: "Point", coordinates: [ -0.1, 52.1 ] },
+        distanceField: "dist.calculated",
+        maxDistance: 2000000,
+        query: { beer_name: *"Heineken"* },
+        includeLocs: "dist.location",
+        num: 1,
+        spherical: true
+    } },
+    { '$project' : { '_id' : 0, 'venue_name' : 1, 'venue_city' : 1, 'dist' : 1 } },
+] ).pretty() </example>
+
+<blurb>Result:</blurb>
+<example inline="1">{
+    "venue_name" : "KLM Crown Lounge 52 (Intercontinental)",
+    "venue_city" : "Luchthaven Schiphol",
+    "dist" : {
+        *"calculated" : 332405.39819979493,*
+        "location" : {
+            "type" : "Point",
+            *"coordinates" : [ 4.76131, 52.3112 ]*
+        }
+    }
+}</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-closest-pub.xml b/slides/mongodb/aggr-closest-pub.xml
new file mode 100644
index 0000000..c608dc2
--- /dev/null
+++ b/slides/mongodb/aggr-closest-pub.xml
@@ -0,0 +1,25 @@
+<slide>
+<title>What is the ~closet pub~ for ~x~ beer?</title>
+
+<blurb>Logical Approach:</blurb>
+<div effect="fade-in"><list><bullet>*find geographically closest item*</bullet></list></div>
+<div effect="fade-in"><list><bullet>*remove* unwanted fields</bullet></list></div>
+
+<div effect="fade-in">
+<break/>
+<blurb>Pipeline:</blurb>
+<example>db.beer.aggregate( [
+</example></div>
+<div effect="fade-in"><example inline="1">    { $geoNear: {
+        *near: { type: "Point", coordinates: [ -0.1, 52.1 ] },*
+        distanceField: *"dist.calculated",*
+        maxDistance: *2000000,*
+        *query*: { beer_name: "Heineken" },
+        includeLocs: *"dist.location",*
+        *num: 1,*
+        spherical: true
+    } },</example></div>
+<div effect="fade-in"><example inline="1">    { '$project' : { '_id' : 0, 'venue_name' : 1, 'venue_city' : 1, 'dist' : 1 } },
+] ).pretty()</example></div>
+
+</slide>
diff --git a/slides/mongodb/aggr-facet-result.xml b/slides/mongodb/aggr-facet-result.xml
new file mode 100644
index 0000000..d95524c
--- /dev/null
+++ b/slides/mongodb/aggr-facet-result.xml
@@ -0,0 +1,46 @@
+<slide>
+<title>Give an *overview* of number of beers per *x*</title>
+
+<example inline="1">db.beer.aggregate( [
+    { *'$facet'* : {
+        'beer_type' :       [ { *'$sortByCount'* : '$beer_type' } ],
+        'brewery_country' : [ { '$sortByCount' : '$brewery_country' } ],
+        'ibu' : [
+            { '$match' : { 'beer_abv' : { '$gte' : 0 } } },
+            { '$bucket' : {
+                groupBy: '$beer_abv',
+                boundaries: [ 0, 2, 4, 6, 8, 10 ],
+                default: 'way-too-much',
+            } }
+        ],
+    } },
+] ).pretty()</example>
+
+<blurb>Result:</blurb>
+<example>
+{
+    "abv" : [
+        { "_id" : 0, "count" : 64 },
+        { "_id" : 2, "count" : 240 },
+        { "_id" : 4, "count" : 2248 },
+        { "_id" : 6, "count" : 966 },
+        { "_id" : 8, "count" : 435 },
+        { "_id" : "way-too-much", "count" : 187 }
+    ],
+
+    "beer_type" : [
+        { "_id" : "Cider", "count" : 730 },
+        { "_id" : "English Bitter", "count" : 164 },
+        { "_id" : "Stout", "count" : 139 },
+        …
+    ],
+    "brewery_country" : [
+        { "_id" : "England", "count" : 1971 },
+        { "_id" : "United States", "count" : 501 },
+        { "_id" : "Belgium", "count" : 405 },
+        …
+    ],
+}
+</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-facet.xml b/slides/mongodb/aggr-facet.xml
new file mode 100644
index 0000000..7b1ccc5
--- /dev/null
+++ b/slides/mongodb/aggr-facet.xml
@@ -0,0 +1,28 @@
+<slide>
+<title>Give an *overview* of number of beers per *x*</title>
+
+<blurb>Facets, new in MongoDB 3.4.</blurb>
+
+<div effect="fade-in">
+<break/>
+<blurb>Pipeline:</blurb>
+<example inline="1">db.beer.aggregate( [
+    { *'$facet'* : {
+        'beer_type' :       [ { *'$sortByCount'* : '$beer_type' } ],
+</example></div>
+<div effect="fade-in">
+<example inline="1">        'brewery_country' : [ { '$sortByCount' : '$brewery_country' } ],
+</example></div>
+<div effect="fade-in">
+<example inline="1">        'abv' : [
+            { '$match' : { 'beer_abv' : { '$gte' : 0 } } },
+            { *'$bucket'* : {
+                groupBy: '$beer_abv',
+                boundaries: [ 0, 2, 4, 6, 8, 10 ],
+                default: 'way-too-much',
+            } }
+        ],
+    } },
+] ).pretty()</example></div>
+
+</slide>
diff --git a/slides/mongodb/aggr-favourite-beer-result.xml b/slides/mongodb/aggr-favourite-beer-result.xml
new file mode 100644
index 0000000..e8a4098
--- /dev/null
+++ b/slides/mongodb/aggr-favourite-beer-result.xml
@@ -0,0 +1,30 @@
+<slide>
+<title>What is your ~favourite~ beer?</title>
+
+<example>db.beer.aggregate( [
+    { '$sort' : { 'rating_score' : -1 } },
+    { '$limit' : 1 },
+] ).pretty()</example>
+
+<blurb>Result:</blurb>
+<example inline="1">
+{
+    "_id" : { "k" : "untappd_20140701215547", "u" : "derick" },
+    "beer_name" : *"Odin's Tipple"*,
+    "brewery_name" : "HaandBryggeriet",
+    "beer_type" : "Russian Imperial Stout",
+    "comment" : "My first 5? Salty seaweed smell. Dark chocolate and just awesome.",
+    "venue_name" : "Cardinal",
+    "venue_city" : "Stavanger",
+    "venue_state" : "Rogaland",
+    "checkin_url" : "https://untappd.com/c/96477647",
+    "beer_url" : "https://untappd.com/beer/10907",
+    "brewery_url" : "https://untappd.com/brewery/2206",
+    "brewery_country" : "Norway",
+    "beer_abv" : 11,
+    *"rating_score" : 5,*
+    "l" : { "type" : "Point", "coordinates" : [ 5.73126, 58.971 ] }
+}
+</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-favourite-beer.xml b/slides/mongodb/aggr-favourite-beer.xml
new file mode 100644
index 0000000..bec8ce1
--- /dev/null
+++ b/slides/mongodb/aggr-favourite-beer.xml
@@ -0,0 +1,17 @@
+<slide>
+<title>What is your ~favourite~ beer?</title>
+
+<blurb>Logical Approach:</blurb>
+<div effect="fade-in"><list><bullet>*sort* by rating *descendingly*</bullet></list></div>
+<div effect="fade-in"><list><bullet>*limit* by *1*</bullet></list></div>
+
+<div effect="fade-in">
+<break/>
+<blurb>Pipeline:</blurb>
+<example>db.beer.aggregate( [
+</example></div>
+<div effect="fade-in"><example>    { '$sort' : { 'rating_score' : -1 } },</example></div>
+<div effect="fade-in"><example>    { '$limit' : 1 },
+] ).pretty()</example></div>
+
+</slide>
diff --git a/slides/mongodb/aggr-favourite-german-beer-result.xml b/slides/mongodb/aggr-favourite-german-beer-result.xml
new file mode 100644
index 0000000..b011f11
--- /dev/null
+++ b/slides/mongodb/aggr-favourite-german-beer-result.xml
@@ -0,0 +1,31 @@
+<slide>
+<title>What is your favourite ~German~ beer?</title>
+
+<example>db.beer.aggregate( [
+    { '$match' : { 'brewery_country' : 'Germany' } },
+    { '$sort' : { 'rating_score' : -1 } },
+    { '$limit' : 1 },
+] ).pretty()</example>
+
+<blurb>Result:</blurb>
+<example inline="1">{
+    "_id" : { "k" : "untappd_20141115152335", "u" : "derick" },
+    "beer_name" : *"Aventinus Eisbock"*,
+    "brewery_name" : "Weisses Bräuhaus G. Schneider &amp; Sohn",
+    "beer_type" : "Eisbock",
+    "comment" : "This is the stuff. I can't say why I like it so much though",
+    "venue_name" : "Tap East",
+    "venue_city" : "Stratford",
+    "venue_state" : "Greater London",
+    "checkin_url" : "https://untappd.com/c/129666676",
+    "beer_url" : "https://untappd.com/beer/67996",
+    "brewery_url" : "https://untappd.com/brewery/1023",
+    *"brewery_country" : "Germany",*
+    "beer_abv" : 12,
+    "beer_ibu" : 15,
+    *"rating_score" : 4.5,*
+    "l" : { "type" : "Point", "coordinates" : [ -0.00878692, 51.5443 ] }
+}
+</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-favourite-german-beer.xml b/slides/mongodb/aggr-favourite-german-beer.xml
new file mode 100644
index 0000000..9522681
--- /dev/null
+++ b/slides/mongodb/aggr-favourite-german-beer.xml
@@ -0,0 +1,19 @@
+<slide>
+<title>What is your favourite ~German~ beer?</title>
+
+<blurb>Logical Approach:</blurb>
+<div effect="fade-in"><list><bullet>*find* all ~German~ beers</bullet></list></div>
+<div effect="fade-in"><list><bullet>*sort* by rating *descendingly*</bullet></list></div>
+<div effect="fade-in"><list><bullet>*limit* by *1*</bullet></list></div>
+
+<div effect="fade-in">
+<break/>
+<blurb>Pipeline:</blurb>
+<example>db.beer.aggregate( [
+</example></div>
+<div effect="fade-in"><example inline="1">    { *'$match' : { 'brewery_country' : 'Germany' }* },</example></div>
+<div effect="fade-in"><example>    { '$sort' : { 'rating_score' : -1 } },</example></div>
+<div effect="fade-in"><example>    { '$limit' : 1 },
+] ).pretty()</example></div>
+
+</slide>
diff --git a/slides/mongodb/aggr-five-stouts-result.xml b/slides/mongodb/aggr-five-stouts-result.xml
new file mode 100644
index 0000000..061d9d7
--- /dev/null
+++ b/slides/mongodb/aggr-five-stouts-result.xml
@@ -0,0 +1,29 @@
+<slide>
+<title>What is your favourite ~German~ beer?</title>
+
+<example>db.beer.aggregate( [
+    { '$match' : { 'brewery_country' : 'Germany' } },
+    { '$sort' : { 'rating_score' : -1 } },
+    { '$project' : { 'beer_name' : 1 } },
+] ).pretty()</example>
+
+<blurb>Result:</blurb>
+<example inline="1">{
+    "_id" : {
+        "k" : "untappd_20140504143324",
+        "u" : "derick"
+    },
+    "beer_name" : "Tokyo* (16.5%)"
+}
+</example>
+
+<div effect="fade-in">
+<blurb>To get rid of the %_id% field too:</blurb>
+<example inline="1">db.beer.aggregate( [
+    { '$match' : { 'brewery_country' : 'Germany' } },
+    { '$sort' : { 'rating_score' : -1 } },
+    { '$project' : { *'_id' : 0*, 'beer_name' : 1 } },
+] ).pretty()</example>
+</div>
+
+</slide>
diff --git a/slides/mongodb/aggr-five-stouts.xml b/slides/mongodb/aggr-five-stouts.xml
new file mode 100644
index 0000000..649a0ce
--- /dev/null
+++ b/slides/mongodb/aggr-five-stouts.xml
@@ -0,0 +1,20 @@
+<slide>
+<title>Can you give me a ~five~ recommendations for ~stouts~?</title>
+
+<blurb>Logical Approach:</blurb>
+<div effect="fade-in"><list><bullet>*find* stouts</bullet></list></div>
+<div effect="fade-in"><list><bullet>*group by* rating</bullet></list></div>
+<div effect="fade-in"><list><bullet>only *show* the beer name</bullet></list></div>
+<div effect="fade-in"><list><bullet>*limit* by *1*</bullet></list></div>
+
+<div effect="fade-in">
+<break/>
+<blurb>Pipeline:</blurb>
+<example>db.beer.aggregate( [
+</example></div>
+<div effect="fade-in"><example>    { '$sort' : { 'beer_abv' : -1 } },
+    { '$limit' : 1 },</example></div>
+<div effect="fade-in"><example inline="1">    { *'$project' : { 'beer_name' : 1 }* },
+] ).pretty()</example></div>
+
+</slide>
diff --git a/slides/mongodb/aggr-ibu-histogram-result-1-2-5.xml b/slides/mongodb/aggr-ibu-histogram-result-1-2-5.xml
new file mode 100644
index 0000000..805f289
--- /dev/null
+++ b/slides/mongodb/aggr-ibu-histogram-result-1-2-5.xml
@@ -0,0 +1,22 @@
+<slide>
+<title>Can you group beers of a similar IBU together?</title>
+
+<blurb>Pipeline:</blurb>
+<example inline="1">db.beer.aggregate( [
+    { '$match' : { 'beer_ibu' : { '$gte' : 0 } } },
+    { '$bucketAuto' : {
+        groupBy: '$beer_ibu',
+        buckets: 10,
+        granularity: *'1-2-5'*
+    } },
+] ).pretty()</example>
+
+<blurb>Result:</blurb>
+<example inline="1">
+{ "_id" : { "min" : *1*, "max" : *2*0 }, "count" : 184 }
+{ "_id" : { "min" : *2*0, "max" : *5*0 }, "count" : 535 }
+{ "_id" : { "min" : *5*0, "max" : *1*00 }, "count" : 215 }
+{ "_id" : { "min" : *1*00, "max" : *5*00 }, "count" : 27 }
+</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-ibu-histogram-result-powersof2.xml b/slides/mongodb/aggr-ibu-histogram-result-powersof2.xml
new file mode 100644
index 0000000..a5a7620
--- /dev/null
+++ b/slides/mongodb/aggr-ibu-histogram-result-powersof2.xml
@@ -0,0 +1,22 @@
+<slide>
+<title>Can you group beers of a similar IBU together?</title>
+
+<blurb>Pipeline:</blurb>
+<example inline="1">db.beer.aggregate( [
+    { '$match' : { 'beer_ibu' : { '$gte' : 0 } } },
+    { '$bucketAuto' : {
+        groupBy: '$beer_ibu',
+        buckets: 10,
+        granularity: *'POWERSOF2'*
+    } },
+] ).pretty()</example>
+
+<blurb>Result:</blurb>
+<example inline="1">{ "_id" : { "min" : 1, "max" : 16 }, "count" : 117 }
+{ "_id" : { "min" : 16, "max" : 32 }, "count" : 332 }
+{ "_id" : { "min" : 32, "max" : 64 }, "count" : 379 }
+{ "_id" : { "min" : 64, "max" : 128 }, "count" : 127 }
+{ "_id" : { "min" : 128, "max" : 256 }, "count" : 6 }
+</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-ibu-histogram-result.xml b/slides/mongodb/aggr-ibu-histogram-result.xml
new file mode 100644
index 0000000..8e40e8d
--- /dev/null
+++ b/slides/mongodb/aggr-ibu-histogram-result.xml
@@ -0,0 +1,27 @@
+<slide>
+<title>Can you group beers of a similar IBU together?</title>
+
+<blurb>Pipeline:</blurb>
+<example inline="1">db.beer.aggregate( [
+    { '$match' : { 'beer_ibu' : { '$gte' : 0 } } },
+    { '$bucketAuto' : {
+        groupBy: '$beer_ibu',
+        buckets: 10,
+    } },
+] ).pretty()</example>
+
+<blurb>Result:</blurb>
+<example inline="1">
+{ "_id" : { "min" : 2, "max" : 16 }, "count" : 117 }
+{ "_id" : { "min" : 16, "max" : 21 }, "count" : 112 }
+{ "_id" : { "min" : 21, "max" : 26 }, "count" : 97 }
+{ "_id" : { "min" : 26, "max" : 31 }, "count" : 116 }
+{ "_id" : { "min" : 31, "max" : 36 }, "count" : 99 }
+{ "_id" : { "min" : 36, "max" : 42 }, "count" : 98 }
+{ "_id" : { "min" : 42, "max" : 51 }, "count" : 116 }
+{ "_id" : { "min" : 51, "max" : 66 }, "count" : 104 }
+{ "_id" : { "min" : 66, "max" : 150 }, "count" : 96 }
+{ "_id" : { "min" : 150, "max" : 200 }, "count" : 6 }
+</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-ibu-histogram.xml b/slides/mongodb/aggr-ibu-histogram.xml
new file mode 100644
index 0000000..6b3d9ce
--- /dev/null
+++ b/slides/mongodb/aggr-ibu-histogram.xml
@@ -0,0 +1,20 @@
+<slide>
+<title>Can you group beers of a similar IBU together?</title>
+
+<blurb>Logical Approach:</blurb>
+<div effect="fade-in"><list><bullet>*find* all beers with an IBU</bullet>
+<bullet>do some *magic grouping*</bullet></list></div>
+
+<div effect="fade-in">
+<break/>
+<blurb>Pipeline:</blurb>
+<example>db.beer.aggregate( [
+</example></div>
+<div effect="fade-in"><example inline="1">    { '$match' : { 'beer_ibu' : { '$gte' : 0 } } },</example></div>
+<div effect="fade-in"><example inline="1">    { *'$bucketAuto'* : {
+        groupBy: *'$beer_ibu'*,
+        buckets: *10*,
+    } },
+] ).pretty()</example></div>
+
+</slide>
diff --git a/slides/mongodb/aggr-most-in-a-day-result.xml b/slides/mongodb/aggr-most-in-a-day-result.xml
new file mode 100644
index 0000000..75e1342
--- /dev/null
+++ b/slides/mongodb/aggr-most-in-a-day-result.xml
@@ -0,0 +1,18 @@
+<slide>
+<title>In ~which venue~ did you taste the most beers?</title>
+
+<example>db.beer.aggregate( [
+    { '$group' : {
+        '_id' : '$venue_name',
+        'count' : { '$sum' : 1 },
+    } },
+    { '$sort' : { 'count' : 1 } },
+    { '$limit' : 1 },
+] ).pretty()
+
+</example>
+
+<blurb>Result:</blurb>
+<example inline="1">{ "_id" : "Euston Cider Tap", "count" : 217 }</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-most-in-a-day.xml b/slides/mongodb/aggr-most-in-a-day.xml
new file mode 100644
index 0000000..f63d3ae
--- /dev/null
+++ b/slides/mongodb/aggr-most-in-a-day.xml
@@ -0,0 +1,23 @@
+<slide>
+<title>In ~which venue~ did you taste the most beers?</title>
+
+<blurb>Logical Approach:</blurb>
+<div effect="fade-in"><list><bullet>*group by* venue</bullet></list></div>
+<div effect="fade-in"><list><bullet>*sort* by count</bullet></list></div>
+<div effect="fade-in"><list><bullet>*limit* by *1*</bullet></list></div>
+
+<div effect="fade-in">
+<break/>
+<blurb>Pipeline:</blurb>
+<example>db.beer.aggregate( [
+</example></div>
+<div effect="fade-in"><example inline="1">    { '$group' : {
+        *'_id' : '$venue_name',*
+        *'count' : { '$sum' : 1 },*
+    } },
+</example></div>
+<div effect="fade-in"><example inline="1">    { '$sort' : { 'count' : -1 } },
+    { '$limit' : 1 },
+] ).pretty()</example></div>
+
+</slide>
diff --git a/slides/mongodb/aggr-most-style.xml b/slides/mongodb/aggr-most-style.xml
new file mode 100644
index 0000000..ad553b3
--- /dev/null
+++ b/slides/mongodb/aggr-most-style.xml
@@ -0,0 +1,34 @@
+<slide>
+<title>What is your most tasted style?</title>
+
+<blurb>Logical Approach:</blurb>
+<div effect="fade-in"><list><bullet>*group* by style and add *count*</bullet>
+<bullet>*sort* by *count* descendingly</bullet></list></div>
+
+<div effect="fade-in-out">
+<break/>
+<blurb>Pipeline:</blurb>
+<example>db.beer.aggregate( [
+    { '$group' : { '_id' : '$beer_type', 'count' : { '$sum': 1 } } },
+    { '$sort' : { 'count' : -1 } },
+] ).pretty()</example></div>
+
+<div effect="fade-in">
+<break/>
+<blurb>Pipeline (in 3.4):</blurb>
+<example inline="1">db.beer.aggregate( [
+    { *'$sortByCount'* : '$beer_type' },
+] ).pretty()</example>
+
+<break/>
+<blurb>Result:</blurb>
+<example>
+{ "_id" : "Cider", "count" : 730 }
+{ "_id" : "English Bitter", "count" : 164 }
+{ "_id" : "Stout", "count" : 139 }
+{ "_id" : "English Pale Ale", "count" : 135 }
+…
+</example>
+</div>
+
+</slide>
diff --git a/slides/mongodb/aggr-our-example-data.xml b/slides/mongodb/aggr-our-example-data.xml
index cea432e..d70a7d0 100644
--- a/slides/mongodb/aggr-our-example-data.xml
+++ b/slides/mongodb/aggr-our-example-data.xml
@@ -1,26 +1,33 @@
 <slide>
 <title>Our Example data</title>
 
-<example>
+<example inline="1">
 {
-	"_id" : ObjectId("5400a24f44670a01098b491d"),
-	"beer_name" : "Aurora Australis",
-	"brewery_name" : "Bridge Road Brewers",
-	"beer_type" : "Belgian Quad",
-	"beer_abv" : 11,
-	"beer_ibu" : 30,
-	"comment" : "Red wine flavours. Brewed in Australia but packaged in Norway.",
-	"venue_name" : "Olympen",
-	"venue_city" : "Oslo",
-	"venue_state" : "Oslo",
-	"venue_lat" : 59.9121,
-	"venue_lng" : 10.7643,
-	"rating_score" : 4.5,
-	"created_at" : ISODate("2014-07-06T20:38:17Z"),
-	"checkin_url" : "https://untappd.com/c/97860912",
-	"beer_url" : "https://untappd.com/beer/300283",
-	"brewery_url" : "https://untappd.com/brewery/3174",
-	"brewery_country" : "Australia"
+    "_id" : {
+        "k" : "untappd_20140706213817",
+        "u" : "derick"
+    },
+    "beer_name" : "Aurora Australis",
+    "brewery_name" : "Bridge Road Brewers",
+    *"beer_type" : "Belgian Quad"*,
+    "comment" : "Red wine flavours. Brewed in Australia but packaged in Norway.",
+    "venue_name" : "Olympen",
+    "venue_city" : "Oslo",
+    "venue_state" : "Oslo",
+    "checkin_url" : "https://untappd.com/c/97860912",
+    "beer_url" : "https://untappd.com/beer/300283",
+    "brewery_url" : "https://untappd.com/brewery/3174",
+    *"brewery_country" : "Australia",*
+    *"beer_abv" : 11*,
+    "beer_ibu" : 30,
+    *"rating_score" : 4.5*,
+    "l" : {
+        "type" : "Point",
+        "coordinates" : [
+            10.7643,
+            59.9121
+        ]
+    }
 }
 </example>
 </slide>
diff --git a/slides/mongodb/aggr-pipelines-ops.xml b/slides/mongodb/aggr-pipelines-ops.xml
index d9178a7..d316761 100644
--- a/slides/mongodb/aggr-pipelines-ops.xml
+++ b/slides/mongodb/aggr-pipelines-ops.xml
@@ -1,17 +1,15 @@
 <slide>
-<title>Pipeline Operators</title>
+<title>Pipeline Stages</title>
 
 <list>
     <bullet>%$match%</bullet>
-    <bullet>%$geoNear%</bullet>
     <bullet>%$project%</bullet>
     <bullet>%$group%</bullet>
     <bullet>%$unwind%</bullet>
-</list>
-<break/>
-<list>
-    <bullet>%$sort%</bullet>
-    <bullet>%$limit%</bullet>
-    <bullet>%$skip%</bullet>
+    <bullet>%$sample% (new in 3.2)</bullet>
+    <bullet>%$sortByCount% (new in 3.4)</bullet>
+    <bullet>%$bucket% / %$bucketAuto% (new in 3.4)</bullet>
+    <bullet>%$geoNear%</bullet>
+    <bullet>%$sort%, %$limit%, %$skip%</bullet>
 </list>
 </slide>
diff --git a/slides/mongodb/aggr-strongest-beer-result.xml b/slides/mongodb/aggr-strongest-beer-result.xml
new file mode 100644
index 0000000..15fd903
--- /dev/null
+++ b/slides/mongodb/aggr-strongest-beer-result.xml
@@ -0,0 +1,55 @@
+<slide>
+<title>What is the ~strongest~ beer you've had?</title>
+
+<div effect="fade-out">
+<example>db.beer.aggregate( [
+    { '$sort' : { 'beer_abv' : -1 } },
+    { '$limit' : 1 },
+    { '$project' : { 'beer_name' : 1 } },
+] ).pretty()</example>
+
+<blurb>Result:</blurb>
+<example inline="1">{
+    "_id" : {
+        "k" : "untappd_20140504143324",
+        "u" : "derick"
+    },
+    "beer_name" : "Tokyo* (16.5%)"
+}
+</example>
+</div>
+
+<div effect="fade-in-out">
+<blurb>To get rid of the %_id% field:</blurb>
+<example inline="1">db.beer.aggregate( [
+    { '$sort' : { 'beer_abv' : -1 } },
+    { '$limit' : 1 },
+    { '$project' : { *'_id' : 0*, 'beer_name' : 1 } },
+] ).pretty()</example>
+</div>
+
+<div effect="fade-in-out">
+<blurb>To rename the field:</blurb>
+<example inline="1">db.beer.aggregate( [
+    { '$sort' : { 'beer_abv' : -1 } },
+    { '$limit' : 1 },
+    { '$project' : { '_id' : 0, *'beer' : '$beer_name'* } }
+] ).pretty()</example>
+</div>
+
+<div effect="fade-in-out">
+<blurb>To add beer name and brewery together:</blurb>
+<example inline="1">db.beer.aggregate( [
+    { '$sort' : { 'beer_abv' : -1 } },
+    { '$limit' : 1 },
+    { '$project' : {
+        '_id' : 0,
+        *'beer' : { '$concat' : [ '$beer_name', ' / ', '$brewery_name' ] }*
+    } }
+] ).pretty()</example>
+
+<blurb>Result:</blurb>
+<example inline="1">{ "beer" : "Tokyo* (16.5%) / BrewDog" }</example>
+</div>
+
+</slide>
diff --git a/slides/mongodb/aggr-strongest-beer.xml b/slides/mongodb/aggr-strongest-beer.xml
new file mode 100644
index 0000000..8f916ff
--- /dev/null
+++ b/slides/mongodb/aggr-strongest-beer.xml
@@ -0,0 +1,19 @@
+<slide>
+<title>What is the ~strongest~ beer you've had?</title>
+
+<blurb>Logical Approach:</blurb>
+<div effect="fade-in"><list><bullet>*sort* by ABV *descendingly*</bullet>
+<bullet>*limit* by *1*</bullet></list></div>
+<div effect="fade-in"><list><bullet>only *show* the beer name</bullet></list></div>
+
+<div effect="fade-in">
+<break/>
+<blurb>Pipeline:</blurb>
+<example>db.beer.aggregate( [
+</example></div>
+<div effect="fade-in"><example>    { '$sort' : { 'beer_abv' : -1 } },
+    { '$limit' : 1 },</example></div>
+<div effect="fade-in"><example inline="1">    { *'$project' : { 'beer_name' : 1 }* },
+] ).pretty()</example></div>
+
+</slide>
diff --git a/slides/mongodb/aggr-which-country-most-distinct-result-step1.xml b/slides/mongodb/aggr-which-country-most-distinct-result-step1.xml
new file mode 100644
index 0000000..31117cf
--- /dev/null
+++ b/slides/mongodb/aggr-which-country-most-distinct-result-step1.xml
@@ -0,0 +1,31 @@
+<slide>
+<title>Where did you taste the most ~distinct~ beers?</title>
+
+<example>db.beer.aggregate( [
+    { '$group' : {
+        '_id' : '$brewery_country',
+        'beers' : { '$addToSet' : '$beer_name' },
+    } },
+] ).pretty()
+</example>
+
+<blurb>Result:</blurb>
+<example inline="1">{
+    "_id" : "Portugal",
+    "beers" : [
+        "Cheers Sem álcool",
+        …
+        "Super Bock Preta Sem Alcool"
+    ]
+}
+{
+    "_id" : "Canada",
+    "beers" : [
+        "CID Rosé",
+        …
+        "Revenante",
+    ]
+}
+</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-which-country-most-distinct-result-step2.xml b/slides/mongodb/aggr-which-country-most-distinct-result-step2.xml
new file mode 100644
index 0000000..9e822fc
--- /dev/null
+++ b/slides/mongodb/aggr-which-country-most-distinct-result-step2.xml
@@ -0,0 +1,23 @@
+<slide>
+<title>Where did you taste the most ~distinct~ beers?</title>
+
+<example inline="1">db.beer.aggregate( [
+    { '$group' : {
+        '_id' : '$brewery_country',
+        'beers' : { '$addToSet' : '$beer_name' },
+    } },
+    *{ '$unwind' : '$beers' },*
+] ).pretty()
+</example>
+
+<blurb>Result:</blurb>
+<example inline="1">{ "_id" : "Portugal", "beers" : "Cheers Sem álcool" }
+…
+{ "_id" : "Portugal", "beers" : "Super Bock Preta Sem Alcool" }
+…
+{ "_id" : "Canada", "beers" : "CID Rosé" }
+…
+{ "_id" : "Canada", "beers" : "Revenante" }
+</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-which-country-most-distinct-result-step3.xml b/slides/mongodb/aggr-which-country-most-distinct-result-step3.xml
new file mode 100644
index 0000000..2cefffa
--- /dev/null
+++ b/slides/mongodb/aggr-which-country-most-distinct-result-step3.xml
@@ -0,0 +1,32 @@
+<slide>
+<title>Where did you taste the most ~distinct~ beers?</title>
+
+<example>db.beer.aggregate( [
+    { '$group' : {
+        '_id' : '$brewery_country',
+        'beers' : { '$addToSet' : '$beer_name' },
+    } },
+    { '$unwind' : '$beers' },
+    { '$group' : { '_id' : '$_id', 'count' : { '$sum' : 1 } } },
+] ).pretty()
+
+</example>
+
+<blurb>Result:</blurb>
+<example inline="1">{ "_id" : "Denmark", "count" : 31 }
+{ "_id" : "Czech Republic", "count" : 19 }
+{ "_id" : "Spain", "count" : 20 }
+{ "_id" : "Argentina", "count" : 13 }
+{ "_id" : "Dominican Republic", "count" : 1 }
+{ "_id" : "Mexico", "count" : 7 }
+{ "_id" : "Norway", "count" : 60 }
+{ "_id" : "Greece", "count" : 5 }
+{ "_id" : "New Zealand", "count" : 6 }
+{ "_id" : "India", "count" : 1 }
+{ "_id" : "Australia", "count" : 5 }
+{ "_id" : "Netherlands", "count" : 79 }
+{ "_id" : "Italy", "count" : 20 }
+…
+</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-which-country-most-distinct-result-step4.xml b/slides/mongodb/aggr-which-country-most-distinct-result-step4.xml
new file mode 100644
index 0000000..d15f11c
--- /dev/null
+++ b/slides/mongodb/aggr-which-country-most-distinct-result-step4.xml
@@ -0,0 +1,31 @@
+<slide>
+<title>Where did you taste the most ~distinct~ beers?</title>
+
+<example inline="1">db.beer.aggregate( [
+    { '$group' : {
+        '_id' : '$brewery_country',
+        'beers' : { '$addToSet' : '$beer_name' },
+    } },
+    { '$unwind' : '$beers' },
+    { '$group' : { '_id' : '$_id', 'count' : { '$sum' : 1 } } },
+    *{ '$sort' : { 'count' : -1 } }*,
+] ).pretty()
+</example>
+
+<blurb>Result:</blurb>
+<example inline="1">{ "_id" : "England", "count" : 912 }
+{ "_id" : "United States", "count" : 320 }
+{ "_id" : "Belgium", "count" : 185 }
+{ "_id" : "Scotland", "count" : 93 }
+{ "_id" : "Germany", "count" : 80 }
+{ "_id" : "Netherlands", "count" : 79 }
+{ "_id" : "Norway", "count" : 60 }
+{ "_id" : "Wales", "count" : 55 }
+{ "_id" : "Canada", "count" : 50 }
+{ "_id" : "Denmark", "count" : 31 }
+{ "_id" : "Sweden", "count" : 26 }
+{ "_id" : "France", "count" : 25 }
+…
+</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-which-country-most-distinct-result.xml b/slides/mongodb/aggr-which-country-most-distinct-result.xml
new file mode 100644
index 0000000..735b5fa
--- /dev/null
+++ b/slides/mongodb/aggr-which-country-most-distinct-result.xml
@@ -0,0 +1,32 @@
+<slide>
+<title>Where did you taste the most ~distinct~ beers?</title>
+
+<example>db.beer.aggregate( [
+    { '$group' : {
+        '_id' : '$brewery_country',
+        'beers' : { '$addToSet' : '$beer_name' },
+    } },
+    { '$unwind' : '$beers' },
+    { '$group' : { '_id' : '$_id', 'count' : { '$sum' : 1 } } },
+    { '$sort' : { 'count' : -1 } },
+] ).pretty()
+
+</example>
+
+<blurb>Result:</blurb>
+<example inline="1">{ "_id" : "England", "count" : 912 }
+{ "_id" : "United States", "count" : 320 }
+{ "_id" : "Belgium", "count" : 185 }
+{ "_id" : "Scotland", "count" : 93 }
+{ "_id" : "Germany", "count" : 80 }
+{ "_id" : "Netherlands", "count" : 79 }
+{ "_id" : "Norway", "count" : 60 }
+{ "_id" : "Wales", "count" : 55 }
+{ "_id" : "Canada", "count" : 50 }
+{ "_id" : "Denmark", "count" : 31 }
+{ "_id" : "Sweden", "count" : 26 }
+{ "_id" : "France", "count" : 25 }
+…
+</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-which-country-most-distinct.xml b/slides/mongodb/aggr-which-country-most-distinct.xml
new file mode 100644
index 0000000..64e8bcc
--- /dev/null
+++ b/slides/mongodb/aggr-which-country-most-distinct.xml
@@ -0,0 +1,23 @@
+<slide>
+<title>Where did you taste the most *distinct* beers?</title>
+
+<div effect="fade-in"><list><bullet>*group by* country and *collect* beer names</bullet></list></div>
+<div effect="fade-in"><list><bullet>*create documents* out of collection</bullet></list></div>
+<div effect="fade-in"><list><bullet>*group by* country and *count* items</bullet></list></div>
+
+<div effect="fade-in">
+<break/>
+<blurb>Pipeline:</blurb>
+<example>db.beer.aggregate( [
+</example></div>
+<div effect="fade-in"><example inline="1">    { '$group' : {
+        '_id' : '$brewery_country',
+        'beers' : *{ '$addToSet' : '$beer_name' }*,
+    } },
+</example></div>
+<div effect="fade-in"><example inline="1">    { *'$unwind' : '$beers'* },</example></div>
+<div effect="fade-in"><example inline="1">    { '$group' : { '_id' : *'$_id'*, 'count' : { '$sum' : 1 } } },</example></div>
+<div effect="fade-in"><example>    { '$sort' : { 'count' : -1 } },
+] ).pretty()</example></div>
+
+</slide>
diff --git a/slides/mongodb/aggr-which-venue-result.xml b/slides/mongodb/aggr-which-venue-result.xml
new file mode 100644
index 0000000..75e1342
--- /dev/null
+++ b/slides/mongodb/aggr-which-venue-result.xml
@@ -0,0 +1,18 @@
+<slide>
+<title>In ~which venue~ did you taste the most beers?</title>
+
+<example>db.beer.aggregate( [
+    { '$group' : {
+        '_id' : '$venue_name',
+        'count' : { '$sum' : 1 },
+    } },
+    { '$sort' : { 'count' : 1 } },
+    { '$limit' : 1 },
+] ).pretty()
+
+</example>
+
+<blurb>Result:</blurb>
+<example inline="1">{ "_id" : "Euston Cider Tap", "count" : 217 }</example>
+
+</slide>
diff --git a/slides/mongodb/aggr-which-venue.xml b/slides/mongodb/aggr-which-venue.xml
new file mode 100644
index 0000000..f63d3ae
--- /dev/null
+++ b/slides/mongodb/aggr-which-venue.xml
@@ -0,0 +1,23 @@
+<slide>
+<title>In ~which venue~ did you taste the most beers?</title>
+
+<blurb>Logical Approach:</blurb>
+<div effect="fade-in"><list><bullet>*group by* venue</bullet></list></div>
+<div effect="fade-in"><list><bullet>*sort* by count</bullet></list></div>
+<div effect="fade-in"><list><bullet>*limit* by *1*</bullet></list></div>
+
+<div effect="fade-in">
+<break/>
+<blurb>Pipeline:</blurb>
+<example>db.beer.aggregate( [
+</example></div>
+<div effect="fade-in"><example inline="1">    { '$group' : {
+        *'_id' : '$venue_name',*
+        *'count' : { '$sum' : 1 },*
+    } },
+</example></div>
+<div effect="fade-in"><example inline="1">    { '$sort' : { 'count' : -1 } },
+    { '$limit' : 1 },
+] ).pretty()</example></div>
+
+</slide>
diff --git a/slides/mongodb/beer-questions.xml b/slides/mongodb/beer-questions.xml
new file mode 100644
index 0000000..369c970
--- /dev/null
+++ b/slides/mongodb/beer-questions.xml
@@ -0,0 +1,13 @@
+<slide>
+<title>Beer Queries</title>
+
+<div effect="fade-in"><list><bullet>What is your *favourite* beer?</bullet></list></div>
+<div effect="fade-in"><list><bullet>What is your favourite *German* beers?</bullet></list></div>
+<div effect="fade-in"><list><bullet>What is the *strongest* beer you've had?</bullet></list></div>
+<div effect="fade-in"><list><bullet>In *which venue* did you taste the most beers?</bullet></list></div>
+<div effect="fade-in"><list><bullet>Where did you taste the most *distinct* beers?</bullet></list></div>
+<div effect="fade-in"><list><bullet>What is the *closet pub* for ~x~ beer?</bullet></list></div>
+<div effect="fade-in"><list><bullet>What is your most tasted style?</bullet></list></div>
+<div effect="fade-in"><list><bullet>Can you group beers of a similar IBU together?</bullet></list></div>
+<div effect="fade-in"><list><bullet>Give an *overview* of number of beers per *x*.</bullet></list></div>
+</slide>
diff --git a/slides/mongodb/i-like-beer.xml b/slides/mongodb/i-like-beer.xml
new file mode 100644
index 0000000..2f2eddc
--- /dev/null
+++ b/slides/mongodb/i-like-beer.xml
@@ -0,0 +1,5 @@
+<slide>
+<title>I Like Beer</title>
+
+<image filename="untappd1.png"/>
+</slide>
diff --git a/slides/mongodb/untappd1.png b/slides/mongodb/untappd1.png
new file mode 100644
index 0000000..58485b0
Binary files /dev/null and b/slides/mongodb/untappd1.png differ