Take the documentation example:
/** @Document */
class BlogPost
{
// ...
/** @ReferenceOne(targetDocument="User", inversedBy="posts") */
private $user;
}
/** @Document */
class User
{
// ...
/** @ReferenceMany(targetDocument="BlogPost", mappedBy="user") */
private $posts;
}
There is any way that i can query for the User entity and retrieve all his posts?
i mean i can use the example query:
db.BlogPost.find({ 'user.$id' : user.id })
But what if i want to do:
db.User.find({ 'id' : id })
And access user posts through User property $posts
Can this be archived?
EDIT
When i perform the query we can found the logs:
[2016-08-15 17:13:45] doctrine.DEBUG: MongoDB query: {"find":true,"query":{"_id":{}},"fields":[],"db":"base","collection":"User"} [] []
[2016-08-15 17:13:45] doctrine.DEBUG: MongoDB query: {"limit":true,"limitNum":1,"query":{"_id":{}},"fields":[]} [] []
[2016-08-15 17:13:45] doctrine.DEBUG: MongoDB query: {"limit":true,"limitNum":null,"query":{"_id":{}},"fields":[]} [] []