MongoCollection
PHP Manual

MongoCollection::createDBRef

(PECL mongo >=0.9.0)

MongoCollection::createDBRefCreates a database reference

설명

public array MongoCollection::createDBRef ( array $a )

인수

a

Object to which to create a reference.

반환값

Returns a database reference array.

예제

Example #1 MongoCollection::createDBRef() example

<?php

$songs 
$db->selectCollection('songs');
$playlists $db->selectCollection('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)));

?>

참고


MongoCollection
PHP Manual