MongoCollection
PHP Manual

MongoCollection::createDBRef

(PECL mongo >=0.9.0)

MongoCollection::createDBRefCreates a database reference

Descrição

public array MongoCollection::createDBRef ( array $a )

Parâmetros

a

Object to which to create a reference.

Valor Retornado

Returns a database reference array.

Exemplos

Exemplo #1 MongoCollection::createDBRef() example

<?php

$songs 
$db->songs;
$playlists $db->playlists;

// create a reference to a song
$manamana $songs->findOne(array('title' => 'Ma na ma na'));
$refToSong $songs->createDBRef($manamana);

// add the reference to my playlist
$playlists->update(array('username' => 'me'), array('$push' => array('songlist' => $refToSong)));

?>

Veja Também


MongoCollection
PHP Manual