MongoCollection::getDBRef

(PECL mongo >=0.9.0)

MongoCollection::getDBRefFetches the document pointed to by a database reference

Opis

public MongoCollection::getDBRef ( array $ref ) : array

Parametry

ref

A database reference.

Zwracane wartości

Returns the database document pointed to by the reference.

Przykłady

Przykład #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";
}

?>

Powyższy przykład wyświetli coś podobnego do:

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
    )
    

Zobacz też:

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top