update : 2015.11.03
php.shukuma.com

검색:
 
 
Fetches the document pointed to by a database reference

MongoCollection::getDBRef

(PECL mongo >=0.9.0)

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

설명

public array MongoCollection::getDBRef ( array $ref )

인수

ref

A database reference.

반환값

Returns the database document pointed to by the reference.

예제

Example #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

In the above example each $songRef looks something like the following:
    Array
    (
        [$ref] => songs
        [$id] => 49902cde5162504500b45c2c
    )
    

참고