MongoId
PHP Manual

MongoId::__toString

(PECL mongo >= 0.8.0)

MongoId::__toString — Returns a hexidecimal representation of this id

Описание

public string MongoId::__toString ( void )

Список параметров

У этой функции нет параметров.

Возвращаемые значения

This id.

Примеры

Пример #1 MongoId::__toString() example

<?php

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

$collection->insert(array( "x" => "y" ));
$collection->insert(array( "x" => "y" ));

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

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

?>

Результатом выполнения данного примера будет что-то подобное:

49a7011a05c677b9a916612a
49a702d5450046d3d515d10d

MongoId
PHP Manual