MongoDB
在线手册:中文 英文
PHP手册

MongoDB::getDBRef

(PECL mongo >=0.9.0)

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

说明

public array MongoDB::getDBRef ( array $ref )

参数

ref

A database reference.

返回值

Returns the document pointed to by the reference.

范例

Example #1 MongoDB::getDBRef() example

Example demonstrating how to get a database reference and what the expected input is.

<?php

 $ref 
= array(
   
'$ref' => 'profiles',
   
'$id' => '47cc67093475061e3d9536d2'
 
);
 
 
$profile $db->getDBRef($ref);
 
?>

See MongoDB::createDBRef() for more information about how to programatically create DB references.


MongoDB
在线手册:中文 英文
PHP手册
PHP手册 - N: Fetches the document pointed to by a database reference

用户评论:

simon at contribute dot com (19-Sep-2011 07:35)

Note, that the $id portion of the array MUST be a MongoId object, otherwise it will fail.