-
-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: Add cookbook about embedding referenced documents using $lookup #2655
Conversation
|
||
In order to make tests, you can import the following documents: | ||
|
||
.. code-block:: php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check how to collapse this less interesting code.
f670aaa
to
a61e48c
Compare
a61e48c
to
347e059
Compare
347e059
to
2bee655
Compare
|
||
[ | ||
[ | ||
'_id' => MongoDB\BSON\ObjectId('667b034c75590cbbe601061c'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not using the new
keyboard to make is clear that's data dump and not actual instantiation of objects.
->lookup('Order') | ||
->alias('orders') | ||
->localField('_id') | ||
->foreignField('user'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we have to set the collection name because the User
class doesn't have an orders
property mapping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few suggestions for improvements, but reads good so far!
Co-authored-by: Andreas Braun <git@alcaeus.org>
* 2.9.x: (24 commits) Fix typo in code example (#2670) Label PRs about GH actions with "CI" (#2632) Review basic mapping (#2668) Fix wording (#2667) Add native type to private properties and final classes (#2666) Review and add tests on `ResolveTargetDocumentListener` (#2660) Remove soft-delete-cookbook (#2657) doc: Remove wakeup and clone cookbook (#2663) Modernize generated code for Hydrators (#2665) Add tests for introduction (#2664) doc: Review mapping ORM and ODM cookbook (#2658) doc: Review cookbook on blending ORM and ODM (#2656) doc: Review and test validation cookbook (#2662) Update custom mapping example (#2654) doc: Review Simple Search Engine Cookbook (#2659) doc: Add cookbook about embedding referenced documents using $lookup (#2655) doc: Add type to properties (#2652) doc: Review custom collections and repository docs (#2653) doc: Review Getting Started (#2650) Move annotations-reference to attributes-reference (#2651) ...
Summary
On reviewing the aggregation stages reference, and in particular
$lookup
, @alcaeus and I decided that we needed more detailed documentation on this specific use case.