downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

MongoDBRef::get> <MongoDBRef
[edit] Last updated: Fri, 18 Sep 2009

view this page in

MongoDBRef::create

(PECL mongo >= 0.9.0)

MongoDBRef::createCreates a new database reference

Описание

public static array MongoDBRef::create ( string $ns , mixed $id )

Параметри

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);
?>

Вж. също



add a note add a note User Contributed Notes MongoDBRef::create
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites