Sekilas<br />PHP + mongoDB<br />HadiAriawan<br />   @hadiariawan<br />   hd.ariawan@gmail.com<br />http://hadiariawan.web....
Instalasi (1)<br />Download mongoDBdi http://www.mongodb.org/downloadspilihversidanmongoDB yang sesuaidengan platform yang...
Instalasi (2)<br />Unzip mongodb-win32-i386-1.6.5 di (misal) D: rename jadimongodb (convenience reason)<br />Lalu create d...
Running mongoDB (1)<br />Buka command prompt (di windows)<br />Bukadirektori d:mongodbbin<br />Execute mongo.exe dansesuai...
Running mongoDB (2)<br />Contoh Screenshot<br />
PHP + mongoDB (1)<br />Duahal yang dibutuhkanuntukmengkoneksikanphpdanmongoDB :<br />1. mongoDB server<br />2. install PHP...
PHP + mongoDB(2)<br />Unzip PHP driver, copy file php_mongo.dll kedalamdirektori extension PHP (biasanya di phpext)<br />T...
Code : Connection<br />Mongo::__construct ([ string $server = "mongodb://localhost:27017" [, array $options = array("conne...
Code : Select Database<br />Mongo::__construct ([ string $server = "mongodb://localhost:27017" [, array $options = array("...
Code : Create Collection<br />public MongoCollectionMongoDB::createCollection ( string $name [, bool $capped = FALSE [, in...
Code : Select Collection<br />public MongoCollectionMongoDB::selectCollection ( string $name )<br />
Code : Insert Record<br />public mixedMongoCollection::insert ( array $a [, array $options = array() ] )<br />
Code : Query<br />public MongoCursorMongoCollection::find ([ array $query = array() [, array $fields = array() ]] )<br />p...
Code : Update<br />public boolMongoCollection::update ( array $criteria , array $newobj [, array $options = array() ] )<br />
Code : Remove<br />public mixedMongoCollection::remove ([ array $criteria = array() [, array $options = array() ]] )<br />
Geospatial Indexing<br />MongoDB supports two-dimensional geospatial indexes. It is designed with location-based queries i...
Code : Query NEAR<br />public boolMongoCollection::ensureIndex ( array $keys [, array $options ] )<br />
PHP Libraries, Frameworks and Tools<br />http://www.mongodb.org/display/DOCS/PHP+Libraries%2C+Frameworks%2C+and+Tools<br /...
TerimaKasih<br />HadiAriawan<br />   @hadiariawan<br />   hd.ariawan@gmail.com<br />http://hadiariawan.web.id<br />
Upcoming SlideShare
Loading in …5
×

Sekilas PHP + mongoDB

4,314 views

Published on

Crash Course PHP and MongoDB

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
4,314
On SlideShare
0
From Embeds
0
Number of Embeds
540
Actions
Shares
0
Downloads
46
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Sekilas PHP + mongoDB

  1. 1. Sekilas<br />PHP + mongoDB<br />HadiAriawan<br /> @hadiariawan<br /> hd.ariawan@gmail.com<br />http://hadiariawan.web.id<br />
  2. 2. Instalasi (1)<br />Download mongoDBdi http://www.mongodb.org/downloadspilihversidanmongoDB yang sesuaidengan platform yang andagunakan.<br />PenulismenggunakanmongoDBversi 1.6.5 di Windows 32 bit<br />
  3. 3. Instalasi (2)<br />Unzip mongodb-win32-i386-1.6.5 di (misal) D: rename jadimongodb (convenience reason)<br />Lalu create direktoriuntuklokasi data (secara default tidak di-create olehmongoDB). Misal D:mongodb-datadb<br />StrukturDirektori :<br />D:mongodb<br />D:mongodb-datadb<br />
  4. 4. Running mongoDB (1)<br />Buka command prompt (di windows)<br />Bukadirektori d:mongodbbin<br />Execute mongo.exe dansesuaikan option dbpath<br />> mongo –-dbpath=d:mongodb-datadb<br />
  5. 5. Running mongoDB (2)<br />Contoh Screenshot<br />
  6. 6. PHP + mongoDB (1)<br />Duahal yang dibutuhkanuntukmengkoneksikanphpdanmongoDB :<br />1. mongoDB server<br />2. install PHP Driver<br />Untukpengguna windows download driver di http://github.com/mongodb/mongo-php-driver/downloads<br />
  7. 7. PHP + mongoDB(2)<br />Unzip PHP driver, copy file php_mongo.dll kedalamdirektori extension PHP (biasanya di phpext)<br />Tambahkanbarisberikutini di file php.ini (di bagian extension)<br />extension=php_mongo.dll <br />Restart web server<br />Periksaphpinfo() untukmemastikan extension mongoDBtelah di load oleh PHP<br />
  8. 8. Code : Connection<br />Mongo::__construct ([ string $server = "mongodb://localhost:27017" [, array $options = array("connect" => TRUE) ]] )<br />
  9. 9. Code : Select Database<br />Mongo::__construct ([ string $server = "mongodb://localhost:27017" [, array $options = array("connect" => TRUE) ]] )<br />
  10. 10. Code : Create Collection<br />public MongoCollectionMongoDB::createCollection ( string $name [, bool $capped = FALSE [, int $size = 0 [, int $max = 0 ]]] )<br />
  11. 11. Code : Select Collection<br />public MongoCollectionMongoDB::selectCollection ( string $name )<br />
  12. 12. Code : Insert Record<br />public mixedMongoCollection::insert ( array $a [, array $options = array() ] )<br />
  13. 13. Code : Query<br />public MongoCursorMongoCollection::find ([ array $query = array() [, array $fields = array() ]] )<br />public intMongoCollection::count ([ array $query = array() [, int $limit = 0 [, int $skip = 0 ]]] )<br />
  14. 14. Code : Update<br />public boolMongoCollection::update ( array $criteria , array $newobj [, array $options = array() ] )<br />
  15. 15. Code : Remove<br />public mixedMongoCollection::remove ([ array $criteria = array() [, array $options = array() ]] )<br />
  16. 16. Geospatial Indexing<br />MongoDB supports two-dimensional geospatial indexes. It is designed with location-based queries in mind, such as "find me the closest N items to my location." It can also efficiently filter on additional criteria, such as "find me the closest N museums to my location."<br />Example :<br />
  17. 17. Code : Query NEAR<br />public boolMongoCollection::ensureIndex ( array $keys [, array $options ] )<br />
  18. 18. PHP Libraries, Frameworks and Tools<br />http://www.mongodb.org/display/DOCS/PHP+Libraries%2C+Frameworks%2C+and+Tools<br />CakePHP<br />CodeIgniter<br />Doctrine<br />Drupal<br />Kohana<br />Lithium<br />Zend Framework<br />etc<br />
  19. 19. TerimaKasih<br />HadiAriawan<br /> @hadiariawan<br /> hd.ariawan@gmail.com<br />http://hadiariawan.web.id<br />

×