com presentations: My demo database now uses "ts" instead of "tags".: slides/mongodb/aggregation-example-cuisine1-match.xml
slides/mongodb/aggregation-example-cuisine2-unwind.xml slides/mongodb/aggregation-example-cuisine3-match.xml
slides/mongodb/aggregation-example-cuisine4-group.xml slides/mongodb/aggregation-example-cuisine5-group-with-sum.xml
slides/mongodb/aggregation-example-cuisine6-sort.xml
| From: | Derick Rethans | Date: | Sat, 13 Apr 2013 09:54:17 +0000 |
| Subject: | com presentations: My demo database now uses "ts" instead of "tags".: slides/mongodb/aggregation-example-cuisine1-match.xml slides/mongodb/aggregation-example-cuisine2-unwind.xml slides/mongodb/aggregation-example-cuisine3-match.xml slides/mongodb/aggregation-example-cuisine4-group.xml slides/mongodb/aggregation-example-cuisine5-group-with-sum.xml slides/mongodb/aggregation-example-cuisine6-sort.xml |
||
| Groups: | php.pres | ||
| Request: | Send a blank email to pres+get-1876@lists.php.net to get a copy of this message | ||
Commit: d2fab2809f355ba92cdaed87b37623573d44b0a4
Author: Derick Rethans <github@derickrethans.nl> Sat, 13 Apr 2013 10:54:17 +0100
Parents: e70ce1e8a5d50539c0383dfd6981b6f2ef790622
Branches: master
Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=d2fab2809f355ba92cdaed87b37623573d44b0a4
Log:
My demo database now uses "ts" instead of "tags".
Changed paths:
M slides/mongodb/aggregation-example-cuisine1-match.xml
M slides/mongodb/aggregation-example-cuisine2-unwind.xml
M slides/mongodb/aggregation-example-cuisine3-match..xml
M slides/mongodb/aggregation-example-cuisine4-group.xml
M slides/mongodb/aggregation-example-cuisine5-group-with-sum.xml
M slides/mongodb/aggregation-example-cuisine6-sort.xml
Diff:
diff --git a/slides/mongodb/aggregation-example-cuisine1-match.xml
b/slides/mongodb/aggregation-example-cuisine1-match.xml
index ccd19ab..832d39f 100644
--- a/slides/mongodb/aggregation-example-cuisine1-match.xml
+++ b/slides/mongodb/aggregation-example-cuisine1-match.xml
@@ -6,7 +6,7 @@ $m = new MongoClient();
$res = $m->demo->poiConcat->aggregate( [
/* First we match all documents that have a cuisine tag: */
- [ '$match' => [ 'tags' => new MongoRegex( '/^cuisine=/' ) ]
],
+ [ '$match' => [ 'ts' => new MongoRegex( '/^cuisine=/' ) ]
],
] );
var_dump( $res['result'] );
diff --git a/slides/mongodb/aggregation-example-cuisine2-unwind.xml
b/slides/mongodb/aggregation-example-cuisine2-unwind.xml
index 8b0a54e..8cc5953 100644
--- a/slides/mongodb/aggregation-example-cuisine2-unwind.xml
+++ b/slides/mongodb/aggregation-example-cuisine2-unwind.xml
@@ -5,9 +5,9 @@
$m = new MongoClient();
$res = $m->demo->poiConcat->aggregate( [
- [ '$match' => [ 'tags' => new MongoRegex( '/^cuisine=/' ) ]
],
- /* Then we unwind all the tags */
- [ '$unwind' => '$tags' ],
+ [ '$match' => [ 'ts' => new MongoRegex( '/^cuisine=/' ) ]
],
+ /* Then we unwind all the ts */
+ [ '$unwind' => '$ts' ],
] );
var_dump( $res['result'] );
diff --git a/slides/mongodb/aggregation-example-cuisine3-match.xml
b/slides/mongodb/aggregation-example-cuisine3-match.xml
index 7d608a7..598b181 100644
--- a/slides/mongodb/aggregation-example-cuisine3-match.xml
+++ b/slides/mongodb/aggregation-example-cuisine3-match.xml
@@ -5,10 +5,10 @@
$m = new MongoClient();
$res = $m->demo->poiConcat->aggregate( [
- [ '$match' => [ 'tags' => new MongoRegex( '/^cuisine=/' ) ]
],
- [ '$unwind' => '$tags' ],
- /* Match again to get rid of all the useless tags */
- [ '$match' => [ 'tags' => new MongoRegex( '/^cuisine=/' ) ]
],
+ [ '$match' => [ 'ts' => new MongoRegex( '/^cuisine=/' ) ]
],
+ [ '$unwind' => '$ts' ],
+ /* Match again to get rid of all the useless ts */
+ [ '$match' => [ 'ts' => new MongoRegex( '/^cuisine=/' ) ]
],
] );
var_dump( $res['result'] );
diff --git a/slides/mongodb/aggregation-example-cuisine4-group.xml
b/slides/mongodb/aggregation-example-cuisine4-group.xml
index 79e9d25..7b768f2 100644
--- a/slides/mongodb/aggregation-example-cuisine4-group.xml
+++ b/slides/mongodb/aggregation-example-cuisine4-group.xml
@@ -5,11 +5,11 @@
$m = new MongoClient();
$res = $m->demo->poiConcat->aggregate( [
- [ '$match' => [ 'tags' => new MongoRegex( '/^cuisine=/' ) ]
],
- [ '$unwind' => '$tags' ],
- [ '$match' => [ 'tags' => new MongoRegex( '/^cuisine=/' ) ]
],
- /* Now we group on the tags */
- [ '$group' => [ '_id' => '$tags' ] ],
+ [ '$match' => [ 'ts' => new MongoRegex( '/^cuisine=/' ) ]
],
+ [ '$unwind' => '$ts' ],
+ [ '$match' => [ 'ts' => new MongoRegex( '/^cuisine=/' ) ]
],
+ /* Now we group on the ts */
+ [ '$group' => [ '_id' => '$ts' ] ],
] );
var_dump( $res['result'] );
diff --git a/slides/mongodb/aggregation-example-cuisine5-group-with-sum.xml
b/slides/mongodb/aggregation-example-cuisine5-group-with-sum.xml
index 3406115..ffc08de 100644
--- a/slides/mongodb/aggregation-example-cuisine5-group-with-sum.xml
+++ b/slides/mongodb/aggregation-example-cuisine5-group-with-sum.xml
@@ -5,11 +5,11 @@
$m = new MongoClient();
$res = $m->demo->poiConcat->aggregate( [
- [ '$match' => [ 'tags' => new MongoRegex( '/^cuisine=/' ) ]
],
- [ '$unwind' => '$tags' ],
- [ '$match' => [ 'tags' => new MongoRegex( '/^cuisine=/' ) ]
],
- /* Now we group on the tags, and add the count */
- [ '$group' => [ '_id' => '$tags', 'count' => [
'$sum' => 1 ] ] ],
+ [ '$match' => [ 'ts' => new MongoRegex( '/^cuisine=/' ) ]
],
+ [ '$unwind' => '$ts' ],
+ [ '$match' => [ 'ts' => new MongoRegex( '/^cuisine=/' ) ]
],
+ /* Now we group on the ts, and add the count */
+ [ '$group' => [ '_id' => '$ts', 'count' => [
'$sum' => 1 ] ] ],
] );
var_dump( $res['result'] );
diff --git a/slides/mongodb/aggregation-example-cuisine6-sort.xml
b/slides/mongodb/aggregation-example-cuisine6-sort.xml
index 4861ece..a6be84c 100644
--- a/slides/mongodb/aggregation-example-cuisine6-sort.xml
+++ b/slides/mongodb/aggregation-example-cuisine6-sort.xml
@@ -5,10 +5,10 @@
$m = new MongoClient();
$res = $m->demo->poiConcat->aggregate( [
- [ '$match' => [ 'tags' => new MongoRegex( '/^cuisine=/' ) ]
],
- [ '$unwind' => '$tags' ],
- [ '$match' => [ 'tags' => new MongoRegex( '/^cuisine=/' ) ]
],
- [ '$group' => [ '_id' => '$tags', 'count' => [
'$sum' => 1 ] ] ],
+ [ '$match' => [ 'ts' => new MongoRegex( '/^cuisine=/' ) ]
],
+ [ '$unwind' => '$ts' ],
+ [ '$match' => [ 'ts' => new MongoRegex( '/^cuisine=/' ) ]
],
+ [ '$group' => [ '_id' => '$ts', 'count' => [
'$sum' => 1 ] ] ],
/* and at last we sort by count */
[ '$sort' => [ 'count' => -1 ] ],
] );