(PECL mongo >=0.9.0)
Fetches the document pointed to by a database reference
public array MongoCollection::getDBRef ( array $ref )
Parameters:
ref
A database reference.
Returns:
Returns the database document pointed to by the reference.
Examples:
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";
}
?>
The above example will output something similar to:
Dazed and Confused Ma na ma na Bohemian Rhapsody
In the above example each $songRef looks something like the following:
Array
(
[$ref] => songs
[$id] => 49902cde5162504500b45c2c
)
See also:
Please login to continue.