Skip to content

How to get MongoObject or MongoCollection object

ichikaway edited this page Jul 8, 2011 · 3 revisions

If you want to use Pecl Mongo functions directly, you can get MongoDb Object or MongoCollection Object.

get MongoDb Object in controller

$mongoDbObject = $this->Model->getMongoDb();

get MongoCollection Object in controller

$mongo = $this->Model->getDataSource();
$mongoCollectionObject = $mongo->getMongoCollection($this->Model);

MongoDbObject

http://jp2.php.net/manual/en/class.mongodb.php

MongoCollectionObject

http://jp2.php.net/manual/en/class.mongocollection.php