com presentations: Rename ensureIndex to createIndex: slides/mongodb/finding-food-import-mongo-shell.xml slides/mongodb/geo-indexes.xml
slides/mongodb/idx-covered.xml slides/mongodb/idx-create.xml slides/mongodb/idx-geo-geohash.xml slides/mongodb/idx-geo.xml
slides/mongodb/idx-multi-key.xml slides/mongodb/idx-or.xml slides/mongodb/idx-sparse.xml slides/mongodb/idx-unique.xml
slides/mongodb/idx-which-one-is-picked.xml slides/mongodb/indexes-geo.xm

From: Date: Mon, 18 May 2015 05:16:01 +0000
Subject: com presentations: Rename ensureIndex to createIndex: slides/mongodb/finding-food-import-mongo-shell.xml slides/mongodb/geo-indexes.xml
slides/mongodb/idx-covered.xml slides/mongodb/idx-create.xml slides/mongodb/idx-geo-geohash.xml slides/mongodb/idx-geo.xml
slides/mongodb/idx-multi-key.xml slides/mongodb/idx-or.xml slides/mongodb/idx-sparse.xml slides/mongodb/idx-unique.xml
slides/mongodb/idx-which-one-is-picked.xml slides/mongodb/indexes-geo.xm
Groups: php.pres 
Request: Send a blank email to pres+get-2082@lists.php.net to get a copy of this message
Commit: 59ade06066b56603f569046179b450d172176999 Author: Jeremy Mikola <jmikola@gmail.com> Mon, 18 May 2015 00:16:01 -0500 Parents: 20f63d6d5eb279c462d3587ef519ee607007cf07 Branches: master Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=59ade06066b56603f569046179b450d172176999 Log: Rename ensureIndex to createIndex Changed paths: M slides/mongodb/finding-food-import-mongo-shell.xml M slides/mongodb/geo-indexes.xml M slides/mongodb/idx-covered.xml M slides/mongodb/idx-create.xml M slides/mongodb/idx-geo-geohash.xml M slides/mongodb/idx-geo.xml M slides/mongodb/idx-multi-key.xml M slides/mongodb/idx-or.xml M slides/mongodb/idx-sparse..xml M slides/mongodb/idx-unique.xml M slides/mongodb/idx-which-one-is-picked.xml M slides/mongodb/indexes-geo.xml M slides/mongodb/indexes3.xml M slides/mongodb/indexes4.xml M slides/mongodb/osm-schema1.xml M slides/mongodb/osm-schema2.xml M slides/mongodb/osm-schema3.xml M slides/mongodb/osm-schema4.xml M slides/mongodb/osm-to-mongo-data3.xml M slides/mongodb/osm-to-mongo-data4.xml M slides/mongodb/text-create-index-php.xml M slides/mongodb/text-create-index.xml M slides/mongodb/text-example.xml M slides/mongodb/text-index-options.xml M slides/mongodb/text-language-specific.xml M slides/mongodb/write-import-script-result.xml M slides/mongodb/write-import-script.xml M slides/mongodb/write-import-script2.xml

diff --git a/slides/mongodb/finding-food-import-mongo-shell.xml b/slides/mongodb/finding-food-import-mongo-shell.xml index 1b2591f..3a4ac76 100644 --- a/slides/mongodb/finding-food-import-mongo-shell.xml +++ b/slides/mongodb/finding-food-import-mongo-shell.xml @@ -11,9 +11,9 @@ doc = { 'oneway' : 'yes' } }; -db.poi.ensureIndex( { 'name' : 1 } ); -db.poi.ensureIndex( { 'tags.highway' : 1 } ); -db.poi.ensureIndex( { 'tags.oneway' : 1 } ); +db.poi.createIndex( { 'name' : 1 } ); +db.poi.createIndex( { 'tags.highway' : 1 } ); +db.poi.createIndex( { 'tags.oneway' : 1 } ); // Road with name=Strand db.poi.find( { 'name' : 'Strand' } ); @@ -34,7 +34,7 @@ db.poi.find( { 'tags.highway' : { '$exists' : 1 } } ); { 'k' : 'oneway', 'v' : 'yes' } } ); -db.poi.ensureIndex( { 'tags.v' : 1, 'tags.k' : 1 } ); +db.poi.createIndex( { 'tags.v' : 1, 'tags.k' : 1 } ); // Road with name=Strand db.poi.find( { @@ -58,7 +58,7 @@ db.poi.find( { 'tags.k' : 'highway' } ); 'oneway=yes' } ); -db.poi.ensureIndex( { 'tags' : 1 } ); +db.poi.createIndex( { 'tags' : 1 } ); // Road with name=Strand db.poi.find( { 'tags' : 'name=Strand' } ); diff --git a/slides/mongodb/geo-indexes.xml b/slides/mongodb/geo-indexes.xml index 17b42d5..364d636 100644 --- a/slides/mongodb/geo-indexes.xml +++ b/slides/mongodb/geo-indexes.xml @@ -22,18 +22,18 @@ db.poiConcat.find( { <blurb>*No index:*<br/> BasicCursor, n: 40, nscannedObjects: 2802711, millis: 1246</blurb> </div> <div effect="fade-in"> - <blurb>*ensureIndex( { ts: 1 } )*<br/>BtreeCursor ts_1, n: 40, nscannedObjects: 3326, millis: 46</blurb> + <blurb>*createIndex( { ts: 1 } )*<br/>BtreeCursor ts_1, n: 40, nscannedObjects: 3326, millis: 46</blurb> </div> <div effect="fade-in-out"> - <blurb>*ensureIndex( { l: '2dsphere' } )*<br/>S2Cursor, n: 40, nscannedObjects: 196884, millis: 257</blurb> + <blurb>*createIndex( { l: '2dsphere' } )*<br/>S2Cursor, n: 40, nscannedObjects: 196884, millis: 257</blurb> </div> <div effect="fade-in-out"> - <blurb>*ensureIndex( { ts: 1} )* &amp;&amp; *ensureIndex( { l: '2dsphere' } )*<br/>S2Cursor, n: 40, nscannedObjects: 196884, millis: 256</blurb> + <blurb>*createIndex( { ts: 1} )* &amp;&amp; *createIndex( { l: '2dsphere' } )*<br/>S2Cursor, n: 40, nscannedObjects: 196884, millis: 256</blurb> </div> <div effect="fade-in-out"> - <blurb>*ensureIndex( { l: '2dsphere', ts: 1 } )*<br/>S2Cursor, n: 40, nscannedObjects: 523, millis: 8</blurb> + <blurb>*createIndex( { l: '2dsphere', ts: 1 } )*<br/>S2Cursor, n: 40, nscannedObjects: 523, millis: 8</blurb> </div> <div effect="fade-in"> - <blurb>*ensureIndex( { ts: 1, l: '2dsphere' } )*<br/>S2Cursor, n: 40, nscannedObjects: 523, millis: 8</blurb> + <blurb>*createIndex( { ts: 1, l: '2dsphere' } )*<br/>S2Cursor, n: 40, nscannedObjects: 523, millis: 8</blurb> </div> </slide> diff --git a/slides/mongodb/idx-covered.xml b/slides/mongodb/idx-covered.xml index baead0c..d2cc193 100644 --- a/slides/mongodb/idx-covered.xml +++ b/slides/mongodb/idx-covered.xml @@ -4,7 +4,7 @@ <blurb>MongoDB can return data from the *index only*:</blurb> <example inline="1"> -db.cities.ensureIndex( { country_code: 1, name: 1 } ); +db.cities.createIndex( { country_code: 1, name: 1 } ); db.cities.find( { country_code: 'NL' }, *{ country_code: 1, name: 1, _id: 0 }* ).explain(); diff --git a/slides/mongodb/idx-create.xml b/slides/mongodb/idx-create.xml index dc52580..4154acf 100644 --- a/slides/mongodb/idx-create.xml +++ b/slides/mongodb/idx-create.xml @@ -1,16 +1,16 @@ <slide> <title>Creating Indexes</title> -<blurb>The %_id% field is always indexed. Additional indexes can be created with %ensureIndex%:</blurb> +<blurb>The %_id% field is always indexed. Additional indexes can be created with %createIndex%:</blurb> <example> // Create an index on the name attribute -db.cities.ensureIndex( { name: 1 } ); +db.cities.createIndex( { name: 1 } ); // Create a compound index on country code and feature code -db.cities.ensureIndex( { country_code: 1, feature_code: 1 } ); +db.cities.createIndex( { country_code: 1, feature_code: 1 } ); // Create an index on the area field of timezone: -db.cities.ensureIndex( { 'timezone.area': 1 } ); +db.cities.createIndex( { 'timezone.area': 1 } ); </example> </slide> diff --git a/slides/mongodb/idx-geo-geohash.xml b/slides/mongodb/idx-geo-geohash.xml index d0d8452..051b486 100644 --- a/slides/mongodb/idx-geo-geohash.xml +++ b/slides/mongodb/idx-geo-geohash.xml @@ -26,7 +26,7 @@ </div> <div effect="fade-in"> -<example inline="1">db.cities.ensureIndex( { location: '2d', *bits: 4* } )</example> +<example inline="1">db.cities.createIndex( { location: '2d', *bits: 4* } )</example> <list> <bullet>Default %bits% is 26, about 0.3 meter resolution (~½ * 40000 / 2^26~)</bullet> </list> diff --git a/slides/mongodb/idx-geo.xml b/slides/mongodb/idx-geo.xml index a0c56f6..f6309e5 100644 --- a/slides/mongodb/idx-geo.xml +++ b/slides/mongodb/idx-geo.xml @@ -2,12 +2,12 @@ <title>Geospatial indexes</title> <blurb>MongoDB supports indexes on two dimensional fields:</blurb> -<example>db.cities.ensureIndex( { location: '2d' } )</example> +<example>db.cities.createIndex( { location: '2d' } )</example> <blurb>and</blurb> <blurb>MongoDB supports indexes on *geospatial fields*:</blurb> -<example>db.cities.ensureIndex( { location: '2dsphere' } )</example> +<example>db.cities.createIndex( { location: '2dsphere' } )</example> </slide> diff --git a/slides/mongodb/idx-multi-key.xml b/slides/mongodb/idx-multi-key.xml index 47e251d..1e195ca 100644 --- a/slides/mongodb/idx-multi-key.xml +++ b/slides/mongodb/idx-multi-key.xml @@ -8,7 +8,7 @@ <blurb>Create as a normal index:</blurb> <example> -db.cities.ensureIndex( { alternatenames: 1 } ); +db.cities.createIndex( { alternatenames: 1 } ); </example> <blurb>The %isMultiKey% field is set to %true%:</blurb> diff --git a/slides/mongodb/idx-or.xml b/slides/mongodb/idx-or.xml index 0714e5f..d07e655 100644 --- a/slides/mongodb/idx-or.xml +++ b/slides/mongodb/idx-or.xml @@ -2,7 +2,7 @@ <title>Indexes with $or</title> <example inline="1"> -db.cities.ensureIndex( { country_code: 1 } ); +db.cities.createIndex( { country_code: 1 } ); db.cities.find( { *$or*: [|f10000|{country_code: 'NL'}|, |00cc00|{country_code: 'BE'}|] } ).explain(); </example> <example inline="1"> diff --git a/slides/mongodb/idx-sparse.xml b/slides/mongodb/idx-sparse.xml index e60979f..bc490c4 100644 --- a/slides/mongodb/idx-sparse.xml +++ b/slides/mongodb/idx-sparse.xml @@ -12,7 +12,7 @@ <div effect="fade-in"> <example inline="1"> -db.cities.ensureIndex( { admin1_code: 1 }, *{ sparse: true }* ); +db.cities.createIndex( { admin1_code: 1 }, *{ sparse: true }* ); </example> <image filename="mongo-compound-index-sparse2.png"/> </div> diff --git a/slides/mongodb/idx-unique.xml b/slides/mongodb/idx-unique.xml index e6c548d..78afc4a 100644 --- a/slides/mongodb/idx-unique.xml +++ b/slides/mongodb/idx-unique.xml @@ -4,7 +4,7 @@ <blurb>Unique indexes prevent multiple documents to match the same index key:</blurb> <example inline="1"> -> db.cities.ensureIndex( { country_code: 1, name: 1 }, *{ unique: true }* ); +> db.cities.createIndex( { country_code: 1, name: 1 }, *{ unique: true }* ); </example> <div effect="fade-in"> @@ -19,7 +19,7 @@ demo.cities.$country_code_1_name_1 dup key: { : "AR", : "Mercedes" } <example> > db.cities.remove( { 'country_code': 'AR', name: 'Mercedes' } ); -> db.cities.ensureIndex( { country_code: 1, name: 1 }, { unique: true } ); +> db.cities.createIndex( { country_code: 1, name: 1 }, { unique: true } ); E11000 duplicate key error index: demo.cities.$country_code_1_name_1 dup key: { : "AR", : "San Pedro" } @@ -30,7 +30,7 @@ demo.cities.$country_code_1_name_1 dup key: { : "AR", : "San Pedro" } <blurb>You can force the index with *dropDups* (|ff9999|This could delete a lot of data!|):</blurb> <example inline="1"> -> db.cities.ensureIndex( { country_code: 1, name: 1 }, +> db.cities.createIndex( { country_code: 1, name: 1 }, { unique: true, *|f10000|dropDups : true|* } ); </example> </div> diff --git a/slides/mongodb/idx-which-one-is-picked.xml b/slides/mongodb/idx-which-one-is-picked.xml index 767077a..3235120 100644 --- a/slides/mongodb/idx-which-one-is-picked.xml +++ b/slides/mongodb/idx-which-one-is-picked.xml @@ -8,8 +8,8 @@ <bullet>MongoDB will re-try plans once in a while</bullet> <bullet>Indexes can be "hinted": <example> -db.cities.ensureIndex( { population: 1, elevation: 1 } ); -db.cities.ensureIndex( { elevation: -1 } ); +db.cities.createIndex( { population: 1, elevation: 1 } ); +db.cities.createIndex( { elevation: -1 } ); db.cities.find( { population: { $gte: 2000000 }, elevation: { $gte : 1654 } }) .sort( { elevation: -1 } ) .hint( { elevation: -1 } );</example> diff --git a/slides/mongodb/indexes-geo.xml b/slides/mongodb/indexes-geo.xml index 51b977c..00043e3 100644 --- a/slides/mongodb/indexes-geo.xml +++ b/slides/mongodb/indexes-geo.xml @@ -6,7 +6,7 @@ <example result="0"><![CDATA[<?php $m = new MongoClient; $c = $m->demo->pubs; $c->drop(); -$c->ensureIndex( [ 'l' => '2d' ] ); +$c->createIndex( [ 'l' => '2d' ] ); $c->insert([ 'name' => 'Betsy Smith', 'l' => [ -0.193, 51.537 ] ]); $c->insert([ 'name' => 'London Tavern', 'l' => [ -0.202, 51.545 ] ]); diff --git a/slides/mongodb/indexes3.xml b/slides/mongodb/indexes3.xml index 4f9ade2..e5ee0ee 100644 --- a/slides/mongodb/indexes3.xml +++ b/slides/mongodb/indexes3.xml @@ -6,7 +6,7 @@ $m = new MongoClient; $c = $m->demo->elephpants; $c->drop(); -$c->ensureIndex( [ 'name' => 1 ] ); +$c->createIndex( [ 'name' => 1 ] ); $c->insert( [ '_id' => 'ele1', 'name' => 'Jumbo' ] ); $c->insert( [ '_id' => 'ele2', 'name' => 'Tantor' ] ); diff --git a/slides/mongodb/indexes4.xml b/slides/mongodb/indexes4.xml index e432c01..168a6df 100644 --- a/slides/mongodb/indexes4.xml +++ b/slides/mongodb/indexes4.xml @@ -2,14 +2,14 @@ <title>More about indexes</title> <blurb>Compound indexes:</blurb> - <example>$myCol->ensureIndex( [ _id => 1, ts => -1 ] )</example> + <example>$myCol->createIndex( [ _id => 1, ts => -1 ] )</example> <break/> <blurb>Indexes can be made on nested fields:</blurb> - <example>$myCol->ensureIndex( [ "article.title" => -1 ] )</example> + <example>$myCol->createIndex( [ "article.title" => -1 ] )</example> <break/> <blurb>Indexes can be made on array values:</blurb> <example><![CDATA[$myCol->insert( [ '_id' => 42, 'values' => [ 'fourty', 'two' ] ] ); -$myCol->ensureIndex( [ 'values' => 1 ] );]]> +$myCol->createIndex( [ 'values' => 1 ] );]]> </example> <break/> <blurb>Searching with regexp: %^%:</blurb> diff --git a/slides/mongodb/osm-schema1.xml b/slides/mongodb/osm-schema1.xml index bd16877..2e32a11 100644 --- a/slides/mongodb/osm-schema1.xml +++ b/slides/mongodb/osm-schema1.xml @@ -8,9 +8,9 @@ 'oneway' => 'yes' ] ]; -$db->poi->ensureIndex( [ 'tags.name' => 1 ] ); -$db->poi->ensureIndex( [ 'tags.highway' => 1 ] ); -$db->poi->ensureIndex( [ 'tags.oneway' => 1 ] ); +$db->poi->createIndex( [ 'tags.name' => 1 ] ); +$db->poi->createIndex( [ 'tags.highway' => 1 ] ); +$db->poi->createIndex( [ 'tags.oneway' => 1 ] ); // Road with name=Strand $db->poi->find( [ 'tags.name' => 'Strand' ] ); diff --git a/slides/mongodb/osm-schema2.xml b/slides/mongodb/osm-schema2.xml index 9b2ce73..2f1655e 100644 --- a/slides/mongodb/osm-schema2.xml +++ b/slides/mongodb/osm-schema2.xml @@ -8,7 +8,7 @@ [ 'k' => 'oneway', 'v' => 'yes' ] ] ]; -$db->poi->ensureIndex( [ 'tags.v' => 1, 'tags.k' => 1 ] ); +$db->poi->createIndex( [ 'tags.v' => 1, 'tags.k' => 1 ] ); // Road with name=Strand $db->poi->find( [ diff --git a/slides/mongodb/osm-schema3.xml b/slides/mongodb/osm-schema3.xml index 9ca8895..339401d 100644 --- a/slides/mongodb/osm-schema3.xml +++ b/slides/mongodb/osm-schema3.xml @@ -8,7 +8,7 @@ [ 'oneway' => 'yes' ], ] ]; -$db->poi->ensureIndex( [ 'tags' => 1 ] ); +$db->poi->createIndex( [ 'tags' => 1 ] ); // Road with name=Strand $db->poi->find( [ 'tags' => [ 'name' => 'Strand' ] ] ); diff --git a/slides/mongodb/osm-schema4.xml b/slides/mongodb/osm-schema4.xml index 47d6b58..9b081ef 100644 --- a/slides/mongodb/osm-schema4.xml +++ b/slides/mongodb/osm-schema4.xml @@ -8,7 +8,7 @@ 'oneway=yes' ] ]; -$db->poi->ensureIndex( [ 'tags' => 1 ] ); +$db->poi->createIndex( [ 'tags' => 1 ] ); // Road with name=Strand $db->poi->find( [ 'tags' => 'name=Strand' ] ); diff --git a/slides/mongodb/osm-to-mongo-data3.xml b/slides/mongodb/osm-to-mongo-data3.xml index 5d067bd..508b94f 100644 --- a/slides/mongodb/osm-to-mongo-data3.xml +++ b/slides/mongodb/osm-to-mongo-data3.xml @@ -19,7 +19,7 @@ <div effect="fade-in"> <blurb>We need an index for that:</blurb> -<example>db.poi.ensureIndex( { "tags.amenity" : 1 } );</example> +<example>db.poi.createIndex( { "tags.amenity" : 1 } );</example> <blurb>And the new "explain" output:</blurb> <example inline="1">db.poi.find( { 'tags.amenity' : 'pub' } ).explain(); { diff --git a/slides/mongodb/osm-to-mongo-data4.xml b/slides/mongodb/osm-to-mongo-data4.xml index cf7f1a1..d700595 100644 --- a/slides/mongodb/osm-to-mongo-data4.xml +++ b/slides/mongodb/osm-to-mongo-data4.xml @@ -12,15 +12,15 @@ } } </example> -<example>db.poi.ensureIndex( { "tags.amenity" : 1 } );</example> +<example>db.poi.createIndex( { "tags.amenity" : 1 } );</example> <div effect="fade-in"> -<example>db.poi.ensureIndex( { "tags.highway" : 1 } );</example> +<example>db.poi.createIndex( { "tags.highway" : 1 } );</example> </div> <div effect="fade-in"> -<example>db.poi.ensureIndex( { "tags.ref" : 1 } );</example> +<example>db.poi.createIndex( { "tags.ref" : 1 } );</example> </div> <div effect="fade-in"> -<example>db.poi.ensureIndex( { "tags.???" : 1 } );</example> +<example>db.poi.createIndex( { "tags.???" : 1 } );</example> <list> <bullet>Lots of indexes make things slow</bullet> <bullet>Limited to 64 indexes</bullet> diff --git a/slides/mongodb/text-create-index-php.xml b/slides/mongodb/text-create-index-php.xml index a4911e2..3228e33 100644 --- a/slides/mongodb/text-create-index-php.xml +++ b/slides/mongodb/text-create-index-php.xml @@ -4,7 +4,7 @@ <example><![CDATA[<?php $m = new MongoClient; -$m->demo->articles->ensureIndex( +$m->demo->articles->createIndex( [ 'subject' => 'text', 'post' => 'text' ], [ 'weights' => [ 'subject' => 10, 'post' => 5 ] ] ); diff --git a/slides/mongodb/text-create-index.xml b/slides/mongodb/text-create-index.xml index 9f988a0..12f77b0 100644 --- a/slides/mongodb/text-create-index.xml +++ b/slides/mongodb/text-create-index.xml @@ -2,7 +2,7 @@ <title>Create a Text Search Index</title> <example> -db.articles.ensureIndex( +db.articles.createIndex( { subject: "text", post: "text" }, { weights: {subject: 10, post: 5} } );</example> diff --git a/slides/mongodb/text-example.xml b/slides/mongodb/text-example.xml index b481f66..e07305b 100644 --- a/slides/mongodb/text-example.xml +++ b/slides/mongodb/text-example.xml @@ -10,7 +10,7 @@ t.save( { _id: 1 , title: "1st post", t.save( { _id: 2 , title: "2nd post" , post: "this is my second blog entry." } ); -t.ensureIndex ( { title: "text", post: "text" }, +t.createIndex ( { title: "text", post: "text" }, { weights: {title: 10, post: 5}} );</example> </div> diff --git a/slides/mongodb/text-index-options.xml b/slides/mongodb/text-index-options.xml index cfc9772..b94ccef 100644 --- a/slides/mongodb/text-index-options.xml +++ b/slides/mongodb/text-index-options.xml @@ -5,14 +5,14 @@ Basic, default weights: </blurb> <example> -db.articles.ensureIndex( { subject: "text", post: "text" } ); +db.articles.createIndex( { subject: "text", post: "text" } ); </example> <blurb> Explicit weights: </blurb> <example> -db.articles.ensureIndex( { subject: "text", post: "text" }, +db.articles.createIndex( { subject: "text", post: "text" }, { weights: { "subject": 10 } } ); </example> @@ -20,14 +20,14 @@ db.articles.ensureIndex( { subject: "text", post: "text" }, Wildcard field: text at any depth, default weights: </blurb> <example> -db.articles.ensureIndex( { "$**": "text" } ); +db.articles.createIndex( { "$**": "text" } ); </example> <blurb> Wildcard field: override default weights and explicit weights: </blurb> <example> -db.articles.ensureIndex( { "$**": "text" }, +db.articles.createIndex( { "$**": "text" }, { weights: {"$**": 10, post: 5 } } ); </example> </slide> diff --git a/slides/mongodb/text-language-specific.xml b/slides/mongodb/text-language-specific.xml index a395aeb..7730de7 100644 --- a/slides/mongodb/text-language-specific.xml +++ b/slides/mongodb/text-language-specific.xml @@ -7,7 +7,7 @@ t = db.search; t.drop(); t.save( { _id: 1, title: "mi blog", post: "Este es un blog de prueba" } ); t.save( { _id: 2, title: "cuchillos son divertido", post: "Es mi tercer blog stemmed" } ); t.save( { _id: 3, title: "My fourth blog", post: "This stemmed blog is in english" } ); -t.ensureIndex( { title: "text", post: "text" }, *{ default_language: "spanish" }* ); +t.createIndex( { title: "text", post: "text" }, *{ default_language: "spanish" }* ); </example> </div> diff --git a/slides/mongodb/write-import-script-result.xml b/slides/mongodb/write-import-script-result.xml index 11266e0..a463930 100644 --- a/slides/mongodb/write-import-script-result.xml +++ b/slides/mongodb/write-import-script-result.xml @@ -17,8 +17,8 @@ $d = $m->demo->poi; $d->drop(); // 3 ADD: Create an index on "name" and a "2d" index on "loc" -$d->ensureIndex( [ 'loc' => '2d' ] ); -$d->ensureIndex( [ 'name' => 1 ] ); +$d->createIndex( [ 'loc' => '2d' ] ); +$d->createIndex( [ 'name' => 1 ] ); var_dump($d->getIndexInfo()); ]]></example> diff --git a/slides/mongodb/write-import-script.xml b/slides/mongodb/write-import-script.xml index 6e23ae6..81222e5 100644 --- a/slides/mongodb/write-import-script.xml +++ b/slides/mongodb/write-import-script.xml @@ -17,8 +17,8 @@ $d = $d-> // 3 ADD: Create an index on "name" and a "2d" index on "loc" -$d->ensureIndex( -$d->ensureIndex( +$d->createIndex( +$d->createIndex( var_dump($d->getIndexInfo()); ]]></example> diff --git a/slides/mongodb/write-import-script2.xml b/slides/mongodb/write-import-script2.xml index 251b506..855aa95 100644 --- a/slides/mongodb/write-import-script2.xml +++ b/slides/mongodb/write-import-script2.xml @@ -7,8 +7,8 @@ </list> <example><![CDATA[<?php // 1 ADD: Indexes for the tags -$d->ensureIndex( [ 'tags_indexed' => 1 ] ); -$d->ensureIndex( [ 'tags_indexed.k' => 1, 'tags_indexed.v' => 1 ] ); +$d->createIndex( [ 'tags_indexed' => 1 ] ); +$d->createIndex( [ 'tags_indexed.k' => 1, 'tags_indexed.v' => 1 ] ); var_dump($d->getIndexInfo()); ]]></example>
« previous php.pres (#2082) next »