Complex References ================== Sometimes you may want to access references on the inverse side of a relationship where you maintain the actual `MongoDbRef`_ to one or many other documents. You can create an `immutable`_ reference to one or many documents and specify how that reference is to be loaded. The available methods for obtaining a cursor to retrieve the references are: - ``criteria`` - The criteria used to get a cursor. - ``repositoryMethod`` - The repository method used to get a cursor. - ``sort`` - What to sort the cursor by. - ``skip`` - The number of documents to skip in the cursor. - ``limit`` - The number of documents to limit the cursor to. Here is an example. You could setup a reference to the last 5 comments for blog posts: .. code-block:: php findBy(array(/** ... */)); } } .. _MongoDbRef: http://php.net/MongoDbRef .. _immutable: http://en.wikipedia.org/wiki/Immutable