Sekilas PHP + Mongodb: Hadi Ariawan
Sekilas PHP + Mongodb: Hadi Ariawan
PHP + mongoDB
Hadi Ariawan
@hadiariawan
[email protected]
http://hadiariawan.web.id
* Download mongoDB di http://
www.mongodb.org/downloads pilih versi dan
mongoDB yang sesuai dengan platform yang
anda gunakan.
* Penulis menggunakan mongoDB versi 1.6.5 di
Windows 32 bit
*Instalasi (1)
* Unzip mongodb-win32-i386-1.6.5 di (misal) D:\
rename jadi mongodb (convenience reason)
* Lalu create direktori untuk lokasi data (secara
default tidak di-create oleh mongoDB). Misal
D:\mongodb-data\db
* Struktur Direktori :
* D:\mongodb
* D:\mongodb-data\db
*Instalasi (2)
* Buka command prompt (di windows)
* Buka direktori d:\mongodb\bin
* Execute mongo.exe dan sesuaikan option
dbpath
* > mongo –-dbpath=d:\mongodb-data\db
*Code : Connection
* Mongo::__construct ([ string $server =
"mongodb://localhost:27017" [, array $options
= array("connect" => TRUE) ]] )
*Code : Query
* public bool MongoCollection::update ( array
$criteria , array $newobj [, array $options =
array() ] )
*Code : Update
* public mixed MongoCollection::remove
([ array $criteria = array() [, array $options =
array() ]] )
*Code : Remove
* 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 :
*Geospatial Indexing
* public bool MongoCollection::ensureIndex
( array $keys [, array $options ] )
*Terima Kasih