downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

MongoCode> <MongoId::__construct
[edit] Last updated: Fri, 18 Sep 2009

view this page in

MongoId::__toString

(PECL mongo >= 0.8.0)

MongoId::__toStringReturns a hexidecimal representation of this id

Описание

public string MongoId::__toString ( void )

Параметри

Тази функция няма параметри.

Връщани стойности

This id.

Примери

Example #1 MongoId::__toString() example

<?php
$obj 
= array( "x" => "y" );

$m = new Mongo();
$collection $m->selectDB("foo")->selectCollection("bar");

$collection->insert($obj);
$collection->insert($obj);

$cursor $collection->find();
$r1 cursor->next();
$r2 cursor->next();

echo 
$r1["_id"] . "\n";
echo 
$r2["_id"] . "\n";
?>

Примерът по-горе ще изведе нещо подобно на:

49a7011a05c677b9a916612a
49a702d5450046d3d515d10d


add a note add a note User Contributed Notes MongoId::__toString
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites