Sekilas PHP + mongoDB
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Sekilas PHP + mongoDB

on

  • 4,230 views

Crash Course PHP and MongoDB

Crash Course PHP and MongoDB

Statistics

Views

Total Views
4,230
Views on SlideShare
3,711
Embed Views
519

Actions

Likes
0
Downloads
38
Comments
0

4 Embeds 519

http://hadiariawan.web.id 402
http://pinstream.me 115
http://feeds.feedburner.com 1
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Sekilas PHP + mongoDB Presentation Transcript

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