(PECL mongo >=0.9.0)
MongoCollection::getDBRef — Fetches the document pointed to by a database reference
$ref
)
ref
A database reference.
Returns the database document pointed to by the reference.
Пример #1 MongoCollection::getDBRef() example
<?php
$playlists = $db->playlists;
$myList = $playlists->findOne(array('username' => 'me'));
// fetch each song in the playlist
foreach ($myList['songlist'] as $songRef) {
$song = $playlists->getDBRef($songRef);
echo $song['title'] . "\n";
}
?>
Результатом выполнения данного примера будет что-то подобное:
Dazed and Confused Ma na ma na Bohemian Rhapsody
Array ( [$ref] => songs [$id] => 49902cde5162504500b45c2c )