MongoDB::getDBRef

(PECL mongo >=0.9.0)
Fetches the document pointed to by a database reference
public array MongoDB::getDBRef ( array $ref )
Parameters:
ref

A database reference.

Returns:

Returns the document pointed to by the reference.

Examples:
MongoDB::getDBRef() example

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

1
2
3
4
5
6
7
8
9
<?php
 
 $ref array(
   '$ref' => 'profiles',
   '$id' => new MongoId('47cc67093475061e3d9536d2')
 );
  
 $profile $db->getDBRef($ref);
 ?>

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

doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.