I am managing two unique collections,
Users collection:
{
"userId": 1,
"name": 'Alice',
"profile": 'alice.png'
},
{
"userId": 5,
"name": 'Bob',
"profile": 'bob.png'
},
{
"userId": 10,
"name": 'Carol Smith',
"profile": 'carol.jpg'
}
Posts collection:
{
"postId": 3,
"userId": 1,
"postContent": "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
"comments": [
{
"comment": "Great post!",
"commentedBy": 5,
},
{
"comment": "Love this!",
"commentedBy": 10,
}
],
}
How do I retrieve post details along with user information for each post and user details for each comment using a single mongoose query?