(PECL mongo >= 0.9.0)
MongoDBRef::create — Creates a new database reference
This extension that defines this class is deprecated. Instead, the MongoDB extension should be used. There is no equivalent for this class in the new extension.
The concept of database references, and hence this class, has been deprecated.
$database] ) : array
If no database is given, the current database is used.
Collection name (without the database name).
The _id field of the object to which to link.
Returns the reference.
Example #1 MongoDBRef::create() example
This creates a database reference to a document in the
addresses collection. The
MongoCollection::getName() function returns the name of
the collection (not including the database name).
$addresses = $db->addresses;
$people = $db->people;
// save $address so it has an _id
// create a reference
$ref = MongoDBRef::create($addresses->getName(), $address['_id']);
// set the field in $person
$person['address'] = $ref;