Werbung
MongoCollection::getDBRef
(PECL mongo >=0.9.0)
MongoCollection::getDBRef — Fetches the document pointed to by a database reference
Beschreibung
public array MongoCollection::getDBRef
( array $ref
)
Parameter-Liste
- ref
-
A database reference.
Rückgabewerte
Returns the database document pointed to by the reference.
Beispiele
PHP Code
1
2
3
4
5
6
7
2
3
4
5
6
7
$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";
}
Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
Dazed and Confused Ma na ma na Bohemian Rhapsody