Re: mysql_fetch_object() equivalent for mongoDB
| From: | Duken Marga | Date: | Wed, 07 Sep 2011 13:39:55 +0000 |
| Subject: | Re: mysql_fetch_object() equivalent for mongoDB | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-314733@lists.php.net to get a copy of this message | ||
Actually, there is no statement in PHP that can return data from
MongoDB as object (CMIIW). Data are returned as array.
You can convert this array to object using (object).
Look an example at
http://www.richardcastera.com/blog/php-convert-array-to-object-with-stdclass
$posts = (object) $mongo->find();
echo 'Id: ' . $posts->Id;
--
Duken Marga
On Wed, Sep 7, 2011 at 1:28 PM, chamila gayan <cgchamila@gmail.com> wrote:
> hi all,
>
> Is anybody aware of mysql_fetch_object() equivalent/similar implementation
> for mongoDB?
> thanks..
>
> ~Chamila Gayan
>