MongoDBRef::create
(PECL mongo >= 0.9.0)
MongoDBRef::create — Creates a new database reference
Описание
Параметри
- ns
-
Database and collection name.
- id
-
The id of the object to link.
Връщани стойности
Returns the reference.
Примери
Example #1 MongoDBRef::create() example
<?php
$addresses = $db->selectCollection('addresses');
$people = $db->selectCollection('people');
// save $address so it has an _id
$addresses->insert($address);
// create a reference
$ref = MongoDBRef::create($addresses->name, $address['_id']);
// set the field in $person
$person['address'] = $ref;
$people->save($person);
?>
Вж. също
- MongoDB::createDBRef - Creates a database reference
- MongoCollection::createDBRef - Creates a database reference
There are no user contributed notes for this page.
