com presentations: Use real life examples for SQL/MongoDB comparison, and fix order for facet slide: slides/mongodb/aggr-facet-result.xml slides/mongodb/query-side-by-side.xml

[email protected] (Derick Rethans) Fri, 13 Apr 2018 09:29:47 +0000
Newsgroups php.pres
Message-ID <[email protected]>
Commit:    187627223a90d8f74717f3dee91ac3124332fc07
Author:    Derick Rethans <[email protected]>         Fri, 13 Apr 2018 12:29:47 +0300
Parents:   afd1ce1b46ab5cf199c54a6829c0a3bf72dc61d8
Branches:  master

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

Log:
Use real life examples for SQL/MongoDB comparison, and fix order for facet slide

Changed paths:
  M  slides/mongodb/aggr-facet-result.xml
  M  slides/mongodb/query-side-by-side.xml


Diff:
diff --git a/slides/mongodb/aggr-facet-result.xml b/slides/mongodb/aggr-facet-result.xml
index d95524c..c370a5b 100644
--- a/slides/mongodb/aggr-facet-result.xml
+++ b/slides/mongodb/aggr-facet-result.xml
@@ -3,9 +3,7 @@
 
 <example inline="1">db.beer.aggregate( [
     { *'$facet'* : {
-        'beer_type' :       [ { *'$sortByCount'* : '$beer_type' } ],
-        'brewery_country' : [ { '$sortByCount' : '$brewery_country' } ],
-        'ibu' : [
+        'abv' : [
             { '$match' : { 'beer_abv' : { '$gte' : 0 } } },
             { '$bucket' : {
                 groupBy: '$beer_abv',
@@ -13,6 +11,8 @@
                 default: 'way-too-much',
             } }
         ],
+        'beer_type' :       [ { *'$sortByCount'* : '$beer_type' } ],
+        'brewery_country' : [ { '$sortByCount' : '$brewery_country' } ],
     } },
 ] ).pretty()</example>
 
diff --git a/slides/mongodb/query-side-by-side.xml b/slides/mongodb/query-side-by-side.xml
index 8013752..74bba48 100644
--- a/slides/mongodb/query-side-by-side.xml
+++ b/slides/mongodb/query-side-by-side.xml
@@ -2,35 +2,35 @@
 <title>Querying</title>
 
 <example>
-SELECT * FROM table;
+SELECT * FROM whisky;
 
-$collection->find( [] );
+$whisky->find( [] );
 </example>
 <example>
-SELECT foo, bar FROM table;
+SELECT name, age FROM whisky;
 
-$collection->find( [], [ 'foo' => 1, 'bar' => 1 ] );
+$whisky->find( [], [ 'name' => 1, 'age' => 1 ] );
 </example>
 <example>
-SELECT * FROM table WHERE a = 42;
+SELECT * FROM whisky WHERE age = 42;
 
-$collection->find( [ 'a' => 42 ] );
+$whisky->find( [ 'age' => 42 ] );
 </example>
 <example>
-SELECT * FROM table WHERE a = 'whisky' AND b > 18;
+SELECT * FROM whisky WHERE name = 'Macallan' AND age > 18;
 
-$collection->find( [ 'a' => 'whisky', 'b' => [ '$gt' => 18 ] ] );
+$whisky->find( [ 'a' => 'Macallan', 'age' => [ '$gt' => 18 ] ] );
 </example>
 <example inline="1">
-SELECT * FROM table WHERE a = 'whisky' OR b > 18;
+SELECT * FROM whisky WHERE name = 'Macallan' OR age > 18;
 
-$collection->find( [ '$or' => *[*
-	[ 'a' => 'whisky' ],
-	[ 'b' => [ '$gt' => 18 ] ]
+$whisky->find( [ '$or' => *[*
+	[ 'name' => 'Macallan' ],
+	[ 'age' => [ '$gt' => 18 ] ]
 *]* ] );
 </example>
 <example>
-SELECT * FROM table1 LEFT JOIN table2 ON (table1.a = table2.b);
+SELECT * FROM whisky LEFT JOIN distillery ON (whisky.distillery_id = distillery.id);
 
 ???
 </example>