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

MongoDBRef::get

(PECL mongo >= 0.9.0)

MongoDBRef::getFetches the object pointed to by a reference

说明

public static array MongoDBRef::get ( MongoDB $db , array $ref )

参数

db

Database to use.

ref

Reference to fetch.

返回值

Returns the document to which the reference refers or NULL if the document does not exist (the reference is broken).

范例

Example #1 MongoCollection::createDBRef() example

<?php

// get $person out of the db
$person $people->findOne();

// dereference the address
$address MongoDBRef::get($people->db$person['address']);

?>

参见


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