colinmollenhour / mongodb-php-odm

A simple but powerful set of wrappers for using MongoDb in PHP (also a Kohana 3 module)
BSD 3-Clause "New" or "Revised" License
208 stars 50 forks source link

Ability to search in referenced model by local id. #8

Closed paulchubatyy closed 13 years ago

paulchubatyy commented 13 years ago

If multiple is set to TRUE then we search in remote model by the field provided. If multiple is set to FALSE then we search in remote model by id field with the values from the local field. If multiple is not set then we just get the remote model by id stored in local field.

Similar to one>many sql relation

paulchubatyy commented 13 years ago

Added the foreign_field key to references. If it is set we assume we need to get the referencing documents from another collection that have that field equal to id of the object.

colinmollenhour commented 13 years ago

Please add documentation for this new feature if you don't mind. Thanks!

paulchubatyy commented 13 years ago

Sure I will, just got my laptop dead, asap I get the new one I will provide the docs.

paulchubatyy commented 13 years ago

I've added the example to the Wiki.