MongoDBRef::create Creates a new database reference &reftitle.description; public static arrayMongoDBRef::create stringcollection mixedid stringdatabase If no database is given, the current database is used. &reftitle.parameters; collection Collection name (without the database name). id The _id field of the object to which to link. database Database name. &reftitle.returnvalues; Returns the reference. &reftitle.examples; <function>MongoDBRef::create</function> 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; $people = $db->people; // save $address so it has an _id $addresses->insert($address); // create a reference $ref = MongoDBRef::create($addresses->getName(), $address['_id']); // set the field in $person $person['address'] = $ref; $people->save($person); ?> ]]> &reftitle.seealso; MongoDB::createDBRef MongoCollection::createDBRef